Chapter 4: Kinds
4.5. Assemblies and body parts

In the previous chapter, we saw that it was possible to make sub-parts of things. For instance,

The white door is in the Drawing Room. The handle is part of the white door.

creates a door with an attached handle. But what if we want to say that not just this door, but every door, should have a handle? To do this we first need to create a kind called "handle", since there will clearly need to be many handles. The solution is:

A handle is a kind of thing. A handle is part of every door.

"Every" is a loaded word and best used sparingly. A sentence like "A handle is part of every handle" would, if taken literally, mean that a handle takes forever to make and is never finished. Inform will reject this, but the moral is clear: we should think about what we are doing with "every". Another restriction is it is not safe to meddle with the three fundamental kinds "room", "container" or "supporter" by making them into assemblies, but in fact this one can be got around quite easily, like so -

A silver coin is a kind of thing. A banking room is a kind of room. Five silver coins are in every banking room.

The effect of sentences like these is to make what we might call "assemblies" instead of single things. When a banking room is created, so are five more silver coins; when a door is created, so is another handle. Such sentences act not only on items created later on in the source text, but also on all those created so far.

This is especially useful for body parts. If we would like to explore Voltaire's suggestion that history would have been very different if only Cleopatra's nose had been shorter, we will need noses:

A nose is a kind of thing. A nose is part of every person.

Something to bear in mind, though, is that in play the following may well happen:

>examine nose
Which do you mean, your nose, Antony's nose or Cleopatra's nose?

...because the player, being also a "person", is as susceptible to the invention of noses as anyone else.

Note that Inform names the otherwise nameless noses after their owners. It will always do this unless there are multiple indistinguishable things being created, as in the "five silver coins are in every banking room" example: those will all just be called "silver coin".

Something to watch out for is that if we write:

A nose is a kind of thing. A nose is part of every person. Antony and Cleopatra are people.

then we can begin talking about "Antony's nose" and "Cleopatra's nose": but it is not safe to discuss these before the sentence "A nose is part of every person" which creates them. Another pitfall is that if we then write:

Marcus Tullius Cicero is a person.

then although "Marcus Tullius Cicero's nose" and "Cicero's nose" are both valid names for the consular nose, "Marcus's nose" is not.


46
* Example  Being Prepared
A kind for jackets, which always includes a container called a pocket.

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

RB

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.

48
*** Example  The Night Before
Instructing Inform to prefer different interpretations of EXAMINE NOSE, depending on whether the player is alone, in company, or with Rudolph the Red-nosed Reindeer.

RB
49
*** Example  U-Stor-It
A "chest" kind which consists of a container which has a lid as a supporter.

RB


PreviousContentsNext