Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics
9.2. Bags, Bottles, Boxes and Safes

The kind "container" allows one thing to contain others. Things are sometimes containers automatically, sometimes by instruction:

The match is in the matchbox. The bucket is a container.

The matchbox, like the bucket, is a container. Containers come in all sizes and have a variety of behaviours, mainly controlled by the properties we give them: they can be "open" or "closed", "opaque" or "transparent" (when closed), "openable" or not, "lockable" or not, "enterable" or not. The basic ideas of containment are to do with carrying and sometimes hiding the contents, and Inform makes this easy. Allowing for locking and unlocking is again straightforward:

The strongbox is a locked container. The little steel key unlocks the strongbox.

For a container with a combination lock, rather than a key, see Safety; for a more sophisticated safe requiring digits dialed over multiple turns, see Eyes, Fingers, Toes.

Trachypachidae Maturin 1803 provides a bottle that is stoppered with a cork: when it is closed, the cork is part of the bottle, but otherwise the cork becomes a separate object we can carry around.

The normal assumption is that there is no problem with any two portable items being carried together, but in reality they may affect each other. (For effects like magnetism, or getting each other wet, or setting each other on fire, see the Physics chapter.) Here is a cat which, if boxed up with one or more items of food, will eat something each turn until all is gone:

The player carries a wicker basket and a scarlet fish. The cat is an animal in the wicker basket. The fish is edible.

Every turn when the cat is in a container (called the bag) and something edible (called the foodstuff) is in the bag:
    remove the foodstuff from play;
    say "With mingled sounds of mewing and chomping, the cat nibbles up [the foodstuff]."

The examples below provide subtler effects, adapting text to the current situation. In Cinco, the container's name changes depending on what it contains: putting beef in a taco allows the player to call it a SHREDDED BEEF TACO. In Unpeeled and Shipping Trunk, the description of something inside a container changes according to other things are alongside it. This is taken further in Hudsucker Industries, which describes the contents of a container as a group.

Finally, any action that destroys a container has to consider what to do with the things inside. Fallout Enclosure demonstrates a zapping action that destroys cash registers and shelves but leaves their contents tidily behind.

* See Liquids for a SHAKE command that makes containers rattle when there are contents

* See Glass and Other Damage-Prone Substances for opening containers by cutting into them

* See Fire for fire damage that spreads between containers and their contents, leaving fireproof objects intact

* See Volume, Height, Weight for containers breaking under the weight of their contents

* See Heat for keeping things warm in insulated containers

* See Furniture for chests with lids that can support other objects

* See Modifying Existing Commands for ways to allow the player to unlock with a key he isn't currently holding


287
* Example  Safety
A safe whose dial can be turned with SPIN SAFE TO 1131, and which will open only with the correct combination.

WI
425
* Example  Eyes, Fingers, Toes
A safe with a multi-number combination, meant to be dialed over multiple turns, is implemented using a log of the last three numbers dialed. The log can then be compared to the safe's correct combination.

WI
327
** Example  Trachypachidae Maturin 1803
Bottles with removable stoppers: when the stopper is in the bottle, the bottle is functionally closed, but the stopper can also be removed and used elsewhere. Descriptions of the bottle reflect its state intelligently.

WI

"Trachypachidae Maturin 1803"

A bottle is a kind of container. Bottles are usually openable, transparent, and closed. A cork is a kind of thing. A cork is in every bottle.

Understand "cork [something]" as corking.

Understand the command "stopper" as "cork".

Understand "uncork [something]" as uncorking.

Corking is an action applying to one thing.

Check corking:
    if the noun is not a bottle, say "[The noun] cannot be corked." instead.

Carry out corking:
    try closing the noun.

Uncorking is an action applying to one thing.

Check uncorking:
    if the noun is not a bottle, say "[The noun] cannot be uncorked." instead.

Carry out uncorking:
    try opening the noun.

Understand "close [something] with [something preferably held]" as corking it with.

Understand "cork [something] with [something preferably held]" as corking it with.

Corking it with is an action applying to one thing and one carried thing.

Check corking it with:
    if the noun is not a bottle, say "[The noun] cannot be corked." instead;
    if the second noun is not a cork, say "[The second noun] will not fit in [the noun]." instead.

Carry out corking it with:
    try inserting the second noun into the noun instead.

Instead of closing a bottle:
    if a cork (called the item) is carried by the player, try inserting the item into the noun instead;
    otherwise say "You need a stopper of some kind."

Instead of opening a bottle:
    if a cork (called the item) is in the bottle, try taking the item instead;
    otherwise say "[The noun] has no stopper."

Carry out inserting a cork into a bottle:
    now the second noun is closed.

After inserting a cork into a bottle:
    say "You stopper [the second noun] with [the noun]."

Before taking a cork when the noun is in a closed bottle (called the item):
    now the item is open.

Instead of taking a cork when the noun is in a bottle (called the item):
    move the noun to the player;
    say "You pull [the noun] from [the item]." instead.

Before printing the name of a bottle (called target) while not inserting, taking, searching, or removing:
    if the target is closed, say "sealed ";
    otherwise say "now open ".

After printing the name of a bottle (called target) while not inserting, searching, examining, or removing:
    if the target contains a noncork thing, say " containing [a list of noncork things in the target]";
    omit contents in listing.

Instead of examining a bottle:
    say "[The noun] contains [a list of noncork things in the noun]."

Definition: a thing is noncork if it is not a cork.

The Doctor's Cabin is a room. "A dark, cramped triangle, like a slice of cake, except that its sharp end has been cut off: and so low that a moderately tall man would strike his head on the deck above if he were to stand upright. Every free surface is covered with sheets of best Venetian looking-glass, to increase the light filtering in. Long use and the carpenter's ingenuity have packed in a folding cot and table, and lockers are built into unlikely places: lockers filled with specimens, skeletons, sketches, drafts and serial letters." The jug is a bottle in the Doctor's Cabin. The jug contains a beetle. The description of the beetle is "The doctor assures you that it is a nondescript."

Test me with "get jug / x jug / open jug / x jug / i / x cork / cork jug / i / uncork jug / i / x jug / get beetle / i / close jug / i / x jug".

309
* Example  Cinco
A taco shell that can be referred to (when it contains things) in terms of its contents.

WI
326
* Example  Shipping Trunk
A box of baking soda whose name changes to "completely ineffective baking soda" when it is in a container with something that smells funny.

WI
331
* Example  Unpeeled
Calling an onion "a single yellow onion" when (and only when) it is being listed as the sole content of a room or container.

WI
329
** Example  Hudsucker Industries
Letters which are described differently as a group, depending on whether the player has read none, some, or all of them, and on whether they are alike or unlike.

WI
59
*** Example  Fallout Enclosure
Adding an enclosure kind that includes both containers and supporters in order to simplify text that would apply to both.

WI


PreviousContentsNext