| Chapter 3: Things |

| 3.23. Parts of things

Everything has one and only one kind. This is both good and bad: good for clarity, bad if something needs to behave in two different ways at once. How might we simulate a car with an ignition key, given that no single thing can be both a "vehicle" and a "device" at the same time?

The Inform world model takes the view that such a car is too complicated to be simulated with a single thing. Instead it should be simulated as a vehicle (the car) which has a device (the ignition) attached. This is done using a third kind of containment to those seen so far ("in..." and "on..."): "part of".

> "Buttons"

> The Confectionary Workshop is a room. The Chocolate Machine is here. "The Chocolate Machine has pride of place. A lever and two buttons, one white, the other brown, seem to be the only controls. On top is a hopper."

> A container called the hopper is part of the Chocolate Machine. The lever, the white button and the brown button are parts of the Chocolate Machine.

> The Chocolatier's desk is here. "The Chocolatier evidently works at the imposing green-leather topped desk facing the Machine. It has three drawers with brass handles."

> The upper drawer, the middle drawer and the lower drawer are parts of the desk. The upper drawer, the middle drawer and the lower drawer are openable closed containers. In the middle drawer is a sugared almond. In the lower drawer is a Battenburg cake. On the desk is a liquorice twist.

> The cake, the twist and the almond are edible.

The machine and the desk each have several "parts" representing subsidiary pieces of themselves. The desk is a "supporter" (it needs to be, for the liquorice twist to be on top) but also has three "containers" attached, each of which can be opened or closed independently.

In the interests of realism, the standard rules of play protect these composite things. Thus if the desk were to be moved elsewhere (rolling on sugar casters perhaps) then its parts would move with it, and the player is not allowed to detach parts of things: the drawers can be opened or closed, but not pulled out altogether.

30
| Example Brown A red sticky label which can be attached to anything in the game, or removed again.

"Brown" The Shipping Room is a room. The red sticky label is a thing carried by the player. The description of the red sticky label is "It reads: AIRMAIL[if the label is part of something (called the parent)]. It is stuck to [the parent][end if]." The black crate is a thing in Shipping. The description is "A boring black crate." The brown crate is a thing in Shipping. The description is "An ordinary brown crate." After examining something when the label is part of the noun: say "A bright red sticky label is attached to [the noun]!" Here is the essential point: whenever we ATTACH LABEL TO something, it becomes part of that object. Instead of tying the red sticky label to something: now the red sticky label is part of the second noun; say "You stick [the label] to [the second noun]." And of course the label cannot be stuck to itself or to more than one thing at a time. Before tying the label to something when the label is part of something: if the label is part of the second noun begin; say "[The label] is already stuck to [the second noun]." instead; otherwise; say "(first freeing the label)[line break]"; silently try taking the label; if the label is part of something, stop the action; end if. Instead of tying the red sticky label to the label: say "That would ruin the label entirely." Instead of taking the label when the label is part of something: now the player carries the label; say "You peel the label off again."; Much of the rest is just tidying to make sure that the player's commands are redirected into the right syntax. Instead of tying something to the label: try tying the label to the noun. Instead of putting the label on something: try tying the label to the second noun. Instead of inserting the label into something: try tying the label to the second noun. Understand the commands "stick" or "apply" as "tie". We could have created a new "sticking" action, but to keep the example short we will use the built-in "tying" action instead, and respond to the command "stick" just as if it were "tie". Understand "peel [something]" or "peel off [something]" as taking. Test me with "i / put label on the black crate / look / x black / x label / get the label / apply label to brown crate / look / x brown / peel off label / stick label to label".

31
| Example Disappointment Bay 12 A final trip to Disappointment Bay: the scenario turned into a somewhat fuller scene, with various features that have not yet been explained.

Previous | Contents | Next