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

§9.1. Food; §9.2. Bags, Bottles, Boxes and Safes; §9.3. Clothing; §9.4. Money; §9.5. Dice and Playing Cards; §9.6. Reading Matter; §9.7. Painting and Labeling Devices; §9.8. Simple Machines; §9.9. Televisions and Radios; §9.10. Telephones; §9.11. Clocks and Scientific Instruments; §9.12. Cameras and Recording Devices

arrow-up-left.pngContents of The Inform Recipe Book
arrow-left.pngChapter 8: Vehicles, Animals and Furniture
arrow-right.pngChapter 10: Physics: Substances, Ropes, Energy and Weight
arrow-down-right.pngIndexes of the examples

§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 Liquids for things to drink

* See Dispensers and Supplies of Small Objects for a pizza buffet table from which the player may take all the slices he wants


arrow-up.pngStart of Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics
arrow-left.pngBack to Chapter 8: Vehicles, Animals and Furniture: §8.5. Kitchen and Bathroom
arrow-right.pngOnward to §9.2. Bags, Bottles, Boxes and Safes

For instance, if we want to give some objects a flavor:

paste.png "Would you...?"

The House is a room. The mouse is an animal in the House.

The player carries some green eggs and a ham.

A food is a kind of thing that is edible. Food has some text called flavor. The flavor of food is usually "Tolerable."

Things are, in general, not edible by default, so we have to make them edible specifically in order to allow them to be eaten by the player. Here we've defined food to be edible by default, and we have given it a standard piece of flavor text.

The ham and the green eggs are food. The flavor of the green eggs is "Delicious!"

After eating something:
    if the noun provides the property flavor, say "[the flavor of the noun][paragraph break]";
    otherwise say "It's [noun]-flavored."

Note that we use "if the noun provides a flavor..." to make sure that the property exists before attempting to use it. Otherwise, there is the risk that we will try to print a property that does not exist, resulting in errors in the game.

We will only get the "It's [noun]-flavored." response if we successfully eat something that is not a food and does not have flavor text. To test this feature, let's suppose something that isn't exactly food but can theoretically be chewed on:

The player carries some paper. The paper is edible.

Test me with "eat ham / eat green eggs / eat paper".

*ExampleWould you...?
Adding new properties to objects, and checking for their presence.

For instance, if we want to give some objects a flavor:

paste.png "Would you...?"

The House is a room. The mouse is an animal in the House.

The player carries some green eggs and a ham.

A food is a kind of thing that is edible. Food has some text called flavor. The flavor of food is usually "Tolerable."

Things are, in general, not edible by default, so we have to make them edible specifically in order to allow them to be eaten by the player. Here we've defined food to be edible by default, and we have given it a standard piece of flavor text.

The ham and the green eggs are food. The flavor of the green eggs is "Delicious!"

After eating something:
    if the noun provides the property flavor, say "[the flavor of the noun][paragraph break]";
    otherwise say "It's [noun]-flavored."

Note that we use "if the noun provides a flavor..." to make sure that the property exists before attempting to use it. Otherwise, there is the risk that we will try to print a property that does not exist, resulting in errors in the game.

We will only get the "It's [noun]-flavored." response if we successfully eat something that is not a food and does not have flavor text. To test this feature, let's suppose something that isn't exactly food but can theoretically be chewed on:

The player carries some paper. The paper is edible.

Test me with "eat ham / eat green eggs / eat paper".

*ExampleCandy
One of several identical candies chosen at the start of play to be poisonous.

*ExampleMRE
Hunger that eventually kills the player, and foodstuffs that can delay the inevitable by different amounts of time.

*ExampleStone
A soup to which the player can add ingredients, which will have different effects when the player eats.

***ExampleDelicious, Delicious Rocks
Adding a "sanity-check" stage to decide whether an action makes any sense, which occurs before any before rules, implicit taking, or check rules.