9.2. Bags, Bottles, Boxes and Safes

| 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

421
| 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

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

In this scenario, the player starts with a bag full of unsorted letters. These can be polite or rude, but he won't know which until he has examined them. What's more, he is allowed to sort the letters, in which case a group of letters will be shown as (for instance) "two polite letters"; but a group of mixed letters, even if they have all been read, will be called "unsorted letters". Further, the player should be allowed to refer to sorted letters by tone, but not unsorted letters. To do this, we'll need printing the name... and printing the plural name..., as well as some special understanding rules. "Hudsucker Industries" Tone is a kind of value. The tones are effusive, affectionate, polite, curt, and flamingly rude. A letter is a kind of thing. The description of a letter is usually "On inspection, it turns out to be quite [tone]." A letter has a tone. The tone of a letter is usually polite. A letter can be read or unread. A letter is usually unread. Carry out examining a letter: now the noun is read. Before printing the name of a read letter: say "[tone] ". Before printing the name of an ungrouped letter: say "random ". Before printing the plural name of a letter (called the subject): if the subject is grouped: say "[tone] "; otherwise if the number of unread letters which are next to the subject is 0: say "unsorted ". After printing the plural name of a letter (called the subject): if the number of read letters which are next to the subject is 0, say " (all unread, at the moment)" instead; if the number of unread letters which are next to the subject is greater than 0, say " (some as yet unread)" instead. Proximity relates a thing (called X) to a thing (called Y) when the holder of X is the holder of Y. The verb to be next to implies the proximity relation. Definition: a letter is grouped: if it is unread, no; if the number of unread letters next to it is greater than 0, no; repeat with item running through letters which are next to it: if the tone of item is not the tone of it, no; yes. Definition: a letter is ungrouped if it is not grouped. The Mailroom is a room. "Usually a thrumming hive of bee-like workers, but you got in early to get a jump on the day's work." The satchel is carried by the player. Two flamingly rude letters are in the satchel. Five polite letters are in the satchel. The mail wall are fixed in place in the mailroom. "Before you is a wall of mailboxes, including [a list of mailboxes which are part of the mail wall]." The plural of mailbox is mailboxes. A mailbox is a kind of container. The CEO box is a mailbox. The Hold box is a mailbox. The Trash box is a mailbox. Understand "mailbox" as a mailbox. Now, there's a good bit of interaction to streamline. We intend that the player will be taking letters from the satchel, reading them, and putting them (perhaps grouped) into boxes. Our interaction rules should assist in this process as much as possible. To start with, the player will be most likely to examine letters he hasn't read yet: Does the player mean examining a letter (called the subject): if we have examined the subject, it is very unlikely; it is very likely. The rules about taking are more subtle: the player is more likely to want to take an ungrouped letter than a grouped one; he is more likely to want one from the satchel than not; and he is most unlikely to want to take a letter (grouped or ungrouped) that he is already holding. Does the player mean taking a letter (called subject) which is grouped: if the player carries the subject, it is very unlikely; if the subject is in the satchel, it is possible; it is unlikely. Does the player mean taking a letter (called subject) which is ungrouped: if the player carries the subject, it is very unlikely; if the subject is in the satchel, it is very likely; it is possible. And finally, we will assume by default that anything other than examining or taking is most likely to apply to a letter he's already identified: Does the player mean doing something other than examining or taking with a letter (called the subject): if we have examined the subject, it is likely; it is unlikely. And we would also like to understand properties under the same circumstances as printing -- a letter will be identifiable as "polite" if it's already been read and it is either by itself or in a sorted stack of polite letters, but otherwise not. What's more, to make it possible to disambiguate commands in the other direction, we'll call any unsorted letter "random", to represent that the player doesn't know what it is. Understand the tone property as referring to a letter when the item described is grouped. Understand "random" as a letter when the item described is ungrouped. When play begins: now every mailbox is part of the mail wall; repeat with switch count running from 1 to 5: move a random letter to the satchel. Test me with "inventory / examine letter / get letter / i / put letter in ceo box / inventory / get letter / x letter / g / g / i / x letter / g / g / i / put letter in hold box / get letter / g / g / i". That last "repeat" is merely a device to shuffle the order of items in the satchel so that the player will not always encounter the letters in a neatly presorted order, despite our defining them that way. (Of course, that means that the test produced by TEST ME cannot be very exciting...)

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

Previous | Contents | Next