§3.14. Devices and descriptions

A "device" is another of the standard kinds of thing, and should be used for anything which can be switched on or off: a light switch, say, or a slide projector. Devices are generally machines, clockwork or electrical. A device is always either "switched on" or "switched off", but is switched off unless we specify otherwise.

That makes three kinds of thing which will likely change their appearance according to which of their two possible states they are in: doors and containers, which can be open or closed; and devices, which can be switched on or switched off. We would like to produce text accordingly, and we can do this using Inform's ability to make (almost) any piece of text change with circumstances. For instance:

The coffin is an openable container in the Undertomb. "[if open]The lid of a plank coffin yawns open.[otherwise]A plank coffin lies upon the dirt floor of the Tomb."

We could use a similar trick to make the appearance of a device change "if switched on". There will be much more about text substitutions, as instructions in square brackets like these are called, in later chapters.

* See Text with substitutions for more on varying what is printed

arrow-up.pngStart of Chapter 3: Things
arrow-left.pngBack to §3.13. Locks and keys
arrow-right.pngOnward to §3.15. Light and darkness

*ExampleDisenchantment Bay 7
Disenchantment Bay: making the radar and instruments switch on and off.

**ExampleDown Below
A light switch which makes the room it is in dark or light.