Inform provides an either/or property called "edible" and action, "eating", for consuming edible things:
The lardy cake is edible. After eating the lardy cake, say "Sticky but delicious."
One of Inform's rules is that a person can only eat what he or she is holding - normally realistic, but it does prevent, say, eating a cherry off the tree. A procedural rule can override this: see Lollipop Guild. Delicious, Delicious Rocks, on the other hand, 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
As mentioned in this section, the "implicitly taking" activity does not allow us to skip an implicit take entirely. In order to do this, we need to borrow from the chapter on Rulebooks and use a procedural rule. (As we will see, procedural rules allow us to modify how actions are carried out in specific circumstances.)
"Lollipop Guild"
Candyland is a room. "A fizzing, popping wonderland of sugary delights -- from which you are unable to escape."
The giant lollipop is a fixed in place edible thing in Candyland. "Growing right next to the path, on a trunk of white paper, is a giant lollipop colored green and red and white." The description of the lollipop is "If you were very blind, like Aunt Myrtle, you might mistake it for a young sapling just planted: the lollipop is just that leafy shade of green, with swirls of white and red that might be branches or flowers."
The player carries a licorice gumdrop. The gumdrop is edible. The description of the gumdrop is "It is the size of a footstool and is very convenient when you can't reach tall objects."
Procedural rule while eating the lollipop: ignore the carrying requirements rule.
Report eating something:
say "You consume [the noun] with gusto." instead.
Test me with "take lollipop / eat lollipop / drop gumdrop/ eat gumdrop / look".
Note that because of the restrictions on our procedural rule, the player still takes the gumdrop before eating it. If we wanted to extend the rule and allow the player to eat anything he wanted at any time, we might instead write
Procedural rule while eating something: ignore the carrying requirements rule.
|
| Example Stone A soup to which the player can add ingredients, which will have different effects when the player eats. | |
| Example Candy One of several identical candies chosen at the start of play to be poisonous. | |
| Example MRE Hunger that eventually kills the player, and foodstuffs that can delay the inevitable by different amounts of time. | |