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

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


365
*** Example  Lollipop Guild
Overriding the rules to allow the player to eat something without first taking it.

WI
197
*** Example  Delicious, 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.

WI

In some cases, we may want to add new stages to action processing. One possibility is a stage where we check the sanity of what the player is trying to do before executing any of the other commands; so that we avoid, for instance

>EAT ROCK
(first taking the rock)
That's plainly inedible.

Here is how we might insert such a stage in our action processing, using rulebook manipulation.

"Delicious, Delicious Rocks"

Section 1 - Procedure

The sanity-check rules are a rulebook.

This is the sanity-check stage rule:
    abide by the sanity-check rules.

The sanity-check stage rule is listed after the before stage rule in the action-processing rules.

Section 2 - Scenario

Candyland is a room. The lollipop tree is an edible thing in Candyland. The genuine rock is a thing in Candyland.

Sanity-check eating an inedible thing:
    say "Your digestion is so delicate -- you're sure [the noun] wouldn't agree with you." instead.

Test me with "eat lollipop / eat rock".

Notice that now Inform does not try taking the rock before rejecting the player's attempt to eat it.

It is of course possible to get the same effect with

Before eating an inedible thing:
    say "Your digestion is so delicate -- you're sure [the noun] wouldn't agree with you." instead.

...and in a small game with few rules, there's not much reason to add an extra stage. The ability to modify the stages of action processing becomes useful when we have a fairly large game with sophisticated modeling and want to be sure that some kinds of message (such as the sanity-check) are always handled before other things that we might be doing at the before stage (such as generating implicit actions like opening doors before going through them).

46
* Example  Would you...?
Adding new properties to objects, and checking for their presence.

WI
376
* Example  Stone
A soup to which the player can add ingredients, which will have different effects when the player eats.

WI
133
* Example  Candy
One of several identical candies chosen at the start of play to be poisonous.

WI
143
* Example  MRE
Hunger that eventually kills the player, and foodstuffs that can delay the inevitable by different amounts of time.

WI


PreviousContentsNext