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
![]() | Contents of The Inform Recipe Book |
![]() | Chapter 8: Vehicles, Animals and Furniture |
![]() | Chapter 10: Physics: Substances, Ropes, Energy and Weight |
![]() | Indexes 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
|
|
Many older interactive fiction games required the player to find food and eat on a regular basis in order to avoid death. This effect was often unrealistic (since most people can survive much longer than a few hours without eating) and is often seen as an annoyance. However, for the sake of argument, suppose that we do want to construct a hunger-and-death system. To make things a little more interesting, we will postulate that different foods are differently filling, so that if the player manages to find something really caloric, he is off the hook on his hunger search for a while. We will also implement the system so that the player gets messages when he is hungry, then dies a short time later. (The times involved are ludicrously short, but this allows us to see the effects within a simple example. In a real game we would want to allow a considerably longer timer for the hunger to play out.) First, a little scene-setting:
Now we define our food, and add some special instructions for what happens to our hunger counters when the food is eaten:
The first of those two phrases, "now the player is replete", causes the player to cease to be hungry; the second one sets up a future event in which the hunger sets in again. The length of time until that event depends on how satisfying the specific food is. Now we define that event:
Note "if the player is hungry": it is possible that the starvation event will be set up but the player will eat before it occurs; in that case, we want it not to take effect. And now, since we really ought to give the player some warning of what is happening to him:
|
|
Many older interactive fiction games required the player to find food and eat on a regular basis in order to avoid death. This effect was often unrealistic (since most people can survive much longer than a few hours without eating) and is often seen as an annoyance. However, for the sake of argument, suppose that we do want to construct a hunger-and-death system. To make things a little more interesting, we will postulate that different foods are differently filling, so that if the player manages to find something really caloric, he is off the hook on his hunger search for a while. We will also implement the system so that the player gets messages when he is hungry, then dies a short time later. (The times involved are ludicrously short, but this allows us to see the effects within a simple example. In a real game we would want to allow a considerably longer timer for the hunger to play out.) First, a little scene-setting:
Now we define our food, and add some special instructions for what happens to our hunger counters when the food is eaten:
The first of those two phrases, "now the player is replete", causes the player to cease to be hungry; the second one sets up a future event in which the hunger sets in again. The length of time until that event depends on how satisfying the specific food is. Now we define that event:
Note "if the player is hungry": it is possible that the starvation event will be set up but the player will eat before it occurs; in that case, we want it not to take effect. And now, since we really ought to give the player some warning of what is happening to him:
|
|
|