Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics
9.8. Simple Machines

The "device" kind provides for the simplest form of machine: one which is, at any given moment, switched on or switched off. Inform looks after this state, but leaves it to us to make the machine actually do something:

The air-conditioning unit is a device in the Florist's Shop. The air-conditioning is fixed in place and switched on.

Every turn when in the Florist's Shop:
    if the air-conditioning is switched off, say "You worry about the cut flowers in this jungle-hot air.";
    otherwise say "There is an low susurration from the air-conditioning unit."

One primary dictionary definition for a machine is "an apparatus using or applying mechanical power and having several parts", and we often use the "part of" relationship to build machinery. Control Center provides a neat way to display the component parts of a machine to the player who examines it.

One component almost always part of an electrical machine is the (literal) switch, lever or button to control whether they are switched on or off. In Model Shop just such an on/off button is automatically made part of every device.

While an electrical device has only two states, a mechanical machine might have many, and for these the best approach is to define a kind of value naming the possibilities: see Signs and Portents, where the states are the possible destinations pointed towards.

Perhaps stretching the definition of "machine", What Makes You Tick demonstrates a fishing pole which the player can put together from several pieces.

* See Bags, Bottles, Boxes and Safes for a safe that can be dialed to different combinations


61
* Example  Control Center
Objects which automatically include a description of their component parts whenever they are examined.

WI
55
** Example  Model Shop
An "on/off button" which controls whatever device it is part of.

WI

Suppose we're particularly mechanically-minded and would like a game in which all of our mechanical devices have buttons to turn them on and off.

"Model Shop"

An on/off button is a kind of thing.

Instead of pushing an on/off button which is part of a switched off device (called the machine):
    try switching on the machine.

Here we are making a rule about how our hypothetical buttons will interact with the machines to which they belong. Instead of pushing... is a rule that pertains to actions, and we will learn more about these in the chapter on actions. "...which is part of a switched off device" provides a specific circumstance - this is only to apply to buttons that are stuck to a machines that can be turned on or off. "(called the machine)" tells Inform that if it finds such a device, it should thereafter refer to it as "the machine." (The called syntax is explained further in the chapter on Change.)

A set of three more rules will complete our instructions about using buttons to control devices:

Instead of pushing an on/off button which is part of a switched on device (called the machine):
    try switching off the machine.

Instead of switching on an on/off button which is part of a device (called the machine):
    try switching on the machine.

Instead of switching off an on/off button which is part of a device (called the machine):
    try switching off the machine.

Then we hand out buttons with a free hand:

One on/off button is part of every device.

The Model Shop is a room. A model train is a fixed in place device in the Model Shop. A toy elephant is a device in the Model Shop.

Every turn when the model train is switched on:
    say "The model train circles your feet, blowing small puffs of steam."

Every turn when the toy elephant is switched on:
    say "The toy elephant waves its trunk at you."

Test me with "push model train's button / push elephant's button / g / switch off model train's button".

And now the game will have a model train's button and a toy elephant's button.

It may be that we want (as an added nuance) to add other names for these items. While we would want an assembly to create objects such as "Lucy's hand" and not "Lucy hand", it is entirely reasonable to want to talk about the model train button or the elephant button. We could define these additional names like so:

Understand "elephant button" or "button on elephant" as the elephant's button.

Understand "model train" or "model" or "train" as "[train]". Understand "[train] button" or "button on [train]" as the model train's button.

In the second case, we are defining [train] to mean any of the three phrases "train", "model", and "model train"; so "[train] button" will match "model train button" or "train button" or "model button" equally well. See the chapter on Understanding for more on how to create alternative phrasings for the player to use.

50
*** Example  Signs and Portents
Signpost that points to various destinations, depending on how the player has turned it.

WI
416
* Example  What Makes You Tick
Building a fishing pole from several component parts that the player might put together in any order.

WI


PreviousContentsNext