9. Props: Food, Clothing, Money, Toys, Books, Electronics

Recipe Book

RB §9.1 Food

Inform provides an either/or property called "edible" and an action, "eating", for consuming edible things:

The lardy cake is edible. After eating the lardy cake, say "Sticky but delicious."

For eating something not immediately to hand, see Lollipop Guild ★★★. Delicious, Delicious Rocks ★★★, conversely, adds a sanity check which prevents the player from automatically taking inedible things only to be told they can't be eaten.

Inform does not normally simulate taste or digestion, but to provide foods with a range of flavours, see Would you…? ; to make eating different foods affect the player differently, see Stone , or for the extreme case of poisoning foods, Candy . In MRE , hunger causes the player problems unless he regularly finds and eats food.

See Also

Liquids for things to drink.
Dispensers and Supplies of Small Objects for a pizza buffet table from which the player may take all the slices he wants.

Examples

Adding new properties to objects, and checking for their presence.
133.
Candy
One of several identical candies chosen at the start of play to be poisonous.
143.
MRE
Hunger that eventually kills the player, and foodstuffs that can delay the inevitable by different amounts of time.
391.
Stone
A soup to which the player can add ingredients, which will have different effects when the player eats.
Adding a "sanity-check" stage to decide whether an action makes any sense, which occurs before any before rules, implicit taking, or check rules.

RB §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.

Two built-in extensions enhance and modify the behavior of locks and keys: Locksmith automates a number of steps, automatically unlocking doors when trying to open them (for instance). Skeleton Keys allows us to define multiple keys that unlock the same object, rather than being restricted to one matching key per item.

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 Also

Liquids for a SHAKE command that makes containers rattle when there are contents.
Glass and Other Damage-Prone Substances for opening containers by cutting into them.
Fire for fire damage that spreads between containers and their contents, leaving fireproof objects intact.
Volume, Height, Weight for containers breaking under the weight of their contents.
Heat for keeping things warm in insulated containers.
Furniture for chests with lids that can support other objects.
Modifying Existing Commands for ways to allow the player to unlock with a key he isn't currently holding.

Examples

298.
Safety
A safe whose dial can be turned with SPIN SAFE TO 1131, and which will open only with the correct combination.
319.
Cinco
A taco shell that can be referred to (when it contains things) in terms of its contents.
A box of baking soda whose name changes to "completely ineffective baking soda" when it is in a container with something that smells funny.
344.
Calling an onion "a single yellow onion" when (and only when) it is being listed as the sole content of a room or container.
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.
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.
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.
35.
Adding an enclosure kind that includes both containers and supporters in order to simplify text that would apply to both.

RB §9.3 Clothing

A person can wear any (portable) thing which has the "wearable" property. (This property seldom needs to be quoted because it is deduced automatically from sentences like "Trevor wears a red hat.")

In most traditional IF, clothing is only used when it is exceptional in some way. That is, we ignore the three to eight different garments most people are wearing at any given time – the everyday clothes which people wear without thinking about them – and only simulate the unexpected extras: a borrowed jaunty red hat, a radiation-proof space suit, and so on.

These unusual garments turn up only occasionally in play and usually one at a time, so Inform does not normally provide rules to restrict how much or little is worn, or in what unlikely combinations. Get Me to the Church on Time ★★★ categorises clothing by body area (trousers for lower body, shirts for upper); Bogart ★★★ by layer, distinguishing underwear from outer garments. What Not To Wear ★★ combines both into a general-purpose system adequate for most kinds of clothing situations.

Hays Code is a somewhat stripped down version.

Clothes are normally single things which have no function other than display and concealment, but Being Prepared gives them pockets which act as containers, and Some Assembly Required allows clothes to be stitched together from pieces of cloth.

See Also

Kitchen and Bathroom for a simple mirror implementation, which could be adapted to reflect what the player is currently wearing.

Examples

A kind for jackets, which always includes a container called a pocket.
Building different styles of shirt from component sleeves and collars.
338.
Clark Gable in a pin-striped suit and a pink thong.
242.
A general-purpose clothing system that handles a variety of different clothing items layered in different combinations over different areas of the body.
Using kinds of clothing to prevent the player from wearing several pairs of trousers at the same time.
234.
Bogart ★★★
Clothing for the player that layers, so that items cannot be taken off in the wrong order, and the player's inventory lists only the clothing that is currently visible.

RB §9.4 Money

Money could be anything which the two people in a bargain both agree is valuable. Here, the player and an ogre agree on a copper coin as money:

The player carries a copper coin. The ogre carries a rock cake. The cake is edible.
Instead of giving the coin to the ogre:
   now the ogre carries the coin;
   now the player carries the cake;
   say "The ogre grunts and hands you a rock cake."

Now Inform does provide an action, "buying", and a command for it, BUY, but they ordinarily respond simply "Nothing is on sale." This is no longer true, so we should make BUY CAKE work. The difficulty here is that a command like BUY CAKE does not specify what should be handed over in exchange. Here we just check that the player has the coin, but in principle we could check for any of a range of monetary tokens – coins, notes, cheque book, debit card, and so on.

Instead of buying the cake:
   if the player has the coin, try giving the coin to the ogre;
   otherwise say "You have no money."

In more advanced economies, where shopping replaces barter, the seller will stock a wide range of differently priced goods. For a tabulated catalogue of wares, see Introduction to Juggling ★★★: to allow the player to negotiate prices, see Money for Nothing ★★. In both of those examples, the player's current financial worth is simulated only as a current total amount of money carried – say, $2.50. This is typical, because in most situations what matters is how much money is in the pocket, not how it is made up. Money behaves more like a liquid than a set of items: hence terms like "liquidity", "cash flow" or Frozen Assets – the name of the simplest example demonstrating this. If we really need a comprehensive simulation down to pieces of currency – where it makes a difference carrying four quarters rather than a dollar bill, because the quarters can be fed into a vending machine – see Nickel and Dimed ★★★.

Fabrication ★★ takes the problem in a different direction, making calculations about the cost of a new garment based on the price of the pattern, the quantity of fabric required, and the value of the fabric type chosen – showing off what we can do with unit multiplication in Inform.

Widget Enterprises explores the challenge of pricing widgets for maximum profit, given certain necessary costs and customers with varying willingness to pay.

See Also

Actions on Multiple Objects for an implementation of giving that allows the player to offer multiple objects at once, where their combined value determines whether they are accepted.

Examples

Allowing the player to set a price for a widget on sale, then determining the resulting sales based on consumer demand, and the resulting profit and loss.
A treatment of money which keeps track of how much the player has on him, and a BUY command which lets him go shopping.
An OFFER price FOR command, allowing the player to bargain with a flexible seller.
269.
A system of assembling clothing from a pattern and materials; both the pattern and the different fabrics have associated prices.
262.
A more intricate system of money, this time keeping track of the individual denominations of coins and bills, specifying what gets spent at each transaction, and calculating appropriate change.
Assortment of equipment defined with price and description, in a table.

RB §9.5 Dice and Playing Cards

Most toys are single things, and no harder to create than any other small items, but games often require a multitude of tokens to be combined, and this can be logistically tricky.

The classic example is a pack of playing cards, where the player must individually control 52 items but without fussy commands or verbose text being printed back. Jokers Wild ★★ provides a simple "one card at a time" approach; Tilt ★★★ is more sophisticated, with 52 independently accessible cards; Tilt 2 ★★★ can further judge the value of a selection of cards – the ranking of a poker hand.

Drawing cards from a shuffled pack is only one source of randomness. Games of chance also involve items drawn from a bag: Wonka's Revenge provides just such a lottery. More often, dice are thrown. A single die is easy enough:

The die is carried by the player. After dropping the die: say "It lands with [a random number from 1 to 6] uppermost." Understand "roll [something]" as dropping.

Quick, but not very good. Most dice games involve rolling more than one die at a time, to get a more interesting distribution of outcomes: they may also involve special rules applying to doubles, for instance. See Do Pass Go .

See Also

Typography for on-screen notations for chess and card games.

Examples

129.
A pair of dice which can be rolled, and are described with their current total when not carried, and have individual scores when examined.
A lottery drum which redistributes the tickets inside whenever the player spins it.
275.
A deck of cards which can be shuffled and dealt from.
318.
Tilt 1 ★★★
A deck of cards with fully implemented individual cards, which can be separately drawn and discarded, and referred to by name.
406.
Tilt 2 ★★★
A deck of cards with fully implemented individual cards; when the player has a full poker hand, the inventory listing describes the resulting hand accordingly.

RB §9.6 Reading Matter

Many things can be read, from warning notices to encyclopaedias, and a range of techniques is needed to provide them because the quantity of text, and how it presents itself, can vary so much. With a small amount of very large type, the player should not need any command at all to read the text:

The road sign is in the Junction. The road sign is fixed in place. "A road sign points north: 'Weston on the Green - 6'."

If the print is smaller, or the object portable, the player will expect to use the EXAMINE command:

The business card is in the Junction. The description is "'Peter de Sèvres: consultant mnemonicist.'"

But if the object is a leaflet, say, EXAMINE should only describe the cover: READ would be the command a player would expect to use to get at the text itself. Inform normally defines READ to be the same command as EXAMINE, which is good for things like the business card, but counter-productive here. The Trouble with Printing shows how to separate these two commands, allowing any thing to have a property called its "printing" for text produced by READ, which will be different from its "description", the text produced by EXAMINE.

If the object is a lengthy diary, say, nobody would read it from cover to cover in a single IF turn. We might then want to allow the player to turn the pages one by one, with commands like READ PAGE 4 IN DIARY or READ THE NEXT PAGE: see Pages .

If the object is an encyclopaedic reference work, the player would consult named entries: see Costa Rican Ornithology ★★★, which allows commands like LOOK UP QUETZAL IN GUIDE.

Still larger sources of text often occur in IF: libraries or bookshelves, where many books are found together, and it is clumsy to write them as many individual items. One approach is to simulate an entire bookshelf with a single thing: see Bibliophilia ★★. (This is much like looking up topics in a single book, except that each topic is a book in itself.) Another is to provide each book as an individual item, but have them automatically join together into a single portable collection: see AARP-Gnosis ★★.

Signs, leaflets and encyclopaedias, being printed, have a wording which will never change during play. But sometimes the player reads something which acts of its own accord. Text substitutions are usually all that is needed to achieve this:

The computer display is on the desk. The description is "Giant green digits read: [the time of day]."

This is easy because we know all the variations we want. But what if we want the player to write his own text, for instance, adding to a diary? This is trickier, because it means storing text as the player typed it, and replaying it later. (And suppose the player types reams and reams of text, not just a few words as we might have hoped?) The Fourth Body and The Fifth Body ★★ show how to use an external file – a multimedia trick requiring features only available if the project is set to the Glulx story file format – to handle even the most difficult cases.

Should we want a computer that responds to vocal commands, as in ASK COMPUTER ABOUT KLINGONS, the built-in extension Inanimate Listeners will allow the player to talk to inanimate objects as well as people.

Examples

Making a READ command, distinct from EXAMINE, for legible objects.
303.
Pages
A book with pages that can be read by number (as in "read page 3 in…") and which accepts relative page references as well (such as "read the last page of…", "read the next page", and so on).
Notebooks in which the player can record assorted notes throughout play.
324.
A bookshelf with a number of books, where the player's command to examine something will be interpreted as an attempt to look up titles if the bookshelf is present, but otherwise given the usual response.
335.
An Encyclopedia set which treats volumes in the same place as a single object, but can also be split up.
443.
An expansion on the notebook, allowing the player somewhat more room in which to type his recorded remark.
A fully-implemented book, answering questions from a table of data, and responding to failed consultation with a custom message such as "You flip through the Guide to Central American Birds, but find no reference to penguins."

RB §9.7 Painting and Labeling Devices

Writing on something is only one way a player can change its visual appearance. IF authors have long been wary of paint brushes, because a sufficiently motivated player could go through a whole landscape like a graffiti artist with a railway bridge. We want to give the player the illusion of freedom of action, while avoiding a situation where unlimited numbers of different decorations might be needed – that would need a table of potentially unlimited size.

One approach is to limit the number of items which can be decorated. In Palette , only the canvas can be painted, and each image overlays the last. Early Childhood ★★★ increases the range to allow a whole kind ("block") to be painted, and also shows how the changing colours can be used to distinguish between otherwise identical objects.

Brown ★★★ finds a different way to limit the number of simultaneous decorations: almost anything can have a red sticky label attached, but there is only one red sticky label. (So to decorate a new item, the player must first un-decorate an old one.)

See Also

Electricity and Magnetism for another form of stickiness.

Examples

308.
An artist's workshop in which the canvas can be painted in any colour, and where painterly names for pigments ("cerulean") are accepted alongside everyday ones ("blue").
36.
Brown ★★★
A red sticky label which can be attached to anything in the game, or removed again.
55.
Early Childhood ★★★
A child's set of building blocks, which come in three different colours – red, green and blue – but which can be repainted during play.

RB §9.8 Simple Machines

The "device" kind provides for the simplest form of machine: one which is, at any given moment, switched on or switched off. Inform looks after this state, but leaves it to us to make the machine actually do something:

The air-conditioning unit is a device in the Florist's Shop. The air-conditioning is fixed in place and switched on.
Every turn when the location is the Florist's Shop:
   if the air-conditioning is switched off, say "You worry about the cut flowers in this jungle-hot air.";
   otherwise say "There is an low susurration from the air-conditioning unit."

One primary dictionary definition for a machine is "an apparatus using or applying mechanical power and having several parts", and we often use the "part of" relationship to build machinery. Control Center provides a neat way to display the component parts of a machine to the player who examines it.

One component almost always part of an electrical machine is the (literal) switch, lever or button to control whether it is switched on or off. In Model Shop ★★ just such an on/off button is automatically made part of every device.

While an electrical device has only two states, a mechanical machine might have many, and for these the best approach is to define a kind of value naming the possibilities: see Signs and Portents ★★★, where the states are the possible destinations pointed towards.

Perhaps stretching the definition of "machine", What Makes You Tick demonstrates a fishing pole which the player can put together from several pieces.

See Also

Bags, Bottles, Boxes and Safes for a safe that can be dialed to different combinations.

Examples

Objects which automatically include a description of their component parts whenever they are examined.
Building a fishing pole from several component parts that the player might put together in any order.
57.
Model Shop ★★
An "on/off button" which controls whatever device it is part of.
53.
Signpost that points to various destinations, depending on how the player has turned it.

RB §9.9 Televisions and Radios

IF authors often provide clues or background information to the player by means of radio broadcasts, TV shows or video tapes because they can talk to the player without needing to listen back, or to react to what the player does. The simplest radio set, like the one in Aftershock ★★★, really only has one thing to say: which is serendipitously being broadcast just at the moment the player tunes in (regardless of when that is). The next simplest approach is to spool a broadcast on an endless loop taking several turns to play through, as in Radio Daze .

Televisions come in all shapes and sizes, and Aspect allows their shape ("aspect ratio") to be described by the player.

In Channel ★★, we can also refer to the television by what it is currently showing: thus WATCH CHANNEL 4 will work if the set is indeed tuned to 4. In Channel 2 ★★★, numbered channel changing is taken further: we can now TUNE TV TO CHANNEL 3, as well. Channel 2 ★★★ is a reasonable base implementation of a television for many purposes.

Examples

66.
A radio that produces a cycle of output using varying text.
311.
Aspect
Understanding aspect ratios (a unit) in the names of televisions.
313.
Channel 1 ★★
Understanding channels (a number) in the names of televisions.
316.
Channel 2 ★★★
Understanding channels (a number) in the names of televisions, with more sophisticated parsing of the change channel action.
336.
Aftershock ★★★
Modifying the rules for examining a device so that all devices have some specific behavior when switched on, which is described at various times.

RB §9.10 Telephones

Telephones are much harder to achieve than televisions and in some ways as difficult to make convincing as a human character is – though of course there are corners which can be cut: we could have the reception drop off, or the other party hang up in a misunderstanding, and so on.

A single telephone line is tricky enough to provide that one might just as well have a general solution providing a whole network. Four Cheeses ★★★ demonstrates a system where we can dial either people or numbers: CALL JANET ON TELEPHONE, or CALL 7103, for instance.

While Four Cheeses ★★★ provides only four-digit phone numbers, like internal company extensions, Alias ★★★ shows how to manage US-style seven digit numbers.

Finally, we might occasionally want the player to be able to address a microphone or telephone receiver directly when the identity of the person on the other end is unknown, in the form TELL MICROPHONE ABOUT CRIME. Ordinarily Inform will disallow this because we're not allowed to talk to inanimate objects, but the extension Inanimate Listeners provides more options.

See Also

Saying Complicated Things for more approaches to conversation.

Examples

226.
Four Cheeses ★★★
A system of telephones on which the player can call distant persons and have conversations.
253.
Alias ★★★
A telephone with phone numbers of the standard American seven-digit length.

RB §9.11 Clocks and Scientific Instruments

The simplest form of clock is a wrist watch. Here is a choice of analogue or digital:

The player wears a wrist watch. The description of the wrist watch is "It is [the time of day in words]."
The player wears a digital watch. The description of the digital watch is "It is [the time of day]."

Better clocks would allow us also to set the time, and to stop and start them: see Tom's Midnight Garden .

Scientific instruments provide sharper versions of our own senses. In the case of vision, they allow us to see closer up, or further away. It's a convention of IF that people can normally see only the current location, that is, they cannot see from one location into another. The boundary of the current room is like a horizon, even out of doors (though it's true that there are ways to disguise that with a continuous outdoor landscape). Ginger Beer ★★ provides a telescope able to see into other rooms.

Witnessed 2 provides a meter which measures how close a ghost is to the player.

See Also

Continuous Spaces and The Outdoors for more on seeing into adjacent locations.
Heat for infrared goggles.

Examples

180.
A piece of ghost-hunting equipment that responds depending on whether or not the meter is on and a ghost is visible or touchable from the current location.
A clock kind that can be set to any time using "the time understood"; may be turned on and off; and will advance itself only when running. Time on the face is also reported differently depending on whether the clock is analog or digital.
365.
A portable magic telescope which allows the player to view items in another room of his choice.

RB §9.12 Cameras and Recording Devices

Recording what is going on, for later playing back or examination, is difficult because the range of situations is very complex. Exactly how much information should we store when we make a recording, and will this require problematically large tables? Will it be difficult even to do at all?

The usual approach is to record only basic details of events or situations. In If It Hadn't Been For… the tape recorder preserves only a few different sounds – footsteps, creaking, rustling – rather than capturing exactly the sound of every action taking place in earshot. In Claims Adjustment ★★, we can take up to 36 Polaroid-style photographs, but each is described only by saying what it is a photo of. Thus we can have a photograph of a vase, or even a photograph of a photograph of a vase (because that too is a thing), but not a photograph of a still life in which several items have been gathered together by the player. That would ordinarily require too much storage.

A similar trick, though involving impromptu sculpture rather than photography, can be found in Originals . (The artist magically "manifests" these models rather than sculpting the conventional way in order to avoid the nuisance of carrying around raw materials – wax maquettes and so forth – which would clutter up the example.)

Text, of course, can store arbitrary descriptions. Mirror, Mirror provides a perfect visual recorder: it remembers a room description exactly as the player saw it at the time.

Actor's Studio ★★ provides a video camera that records and time stamps all actions performed in its presence while it is set to record.

See Also

Telephones for ways to speak to inanimate objects, which might be appropriate when, say, tape-recording a confession.

Examples

A sound recording device that records the noises made by player and non-player actions, then plays them back on demand.
369.
Allowing the player to create models of anything in the game world; parsing the name "model [thing]" or even just "[thing]" to refer to these newly-created models; asking "which do you mean, the model [thing] or the actual [thing]" when there is ambiguity.
The sorcerer's mirror can, when held up high, form an impression of its surroundings which it then preserves.
221.
A video camera that records actions performed in its presence, and plays them back with time-stamps.
An instant camera that spits out photographs of anything the player chooses to take a picture of.