![]() | Chapter 11: Phrases | ![]() ![]() |
11.2. The phrasebook |
Inform begins knowing a set of standard phrases, and allows us to define new ones: the current stock is called the "phrasebook", and can be browsed at the Index panel, where the phrases have links to the appropriate sections of this book describing them. In this chapter, we only cover a few special phrases used to construct other phrases. The first of these is "do nothing": it does nothing, and is very occasionally useful to say that a rule does nothing. (Such a rule might not be useless - it might block other rules from taking effect.)
Here is a simple definition of a new phrase:
To spring the trap: say "'Sproing!' go the hinges and, with a flash of silver, the enormous blades whisk together!"; end the game in death.
Now the phrase "spring the trap" is given meaning. Of course it will only happen if our design ever actually calls upon the computer to "spring the trap", which at present it does not.
This is a short and simple definition, but for longer ones it is usual to lay out the instructions in a list rather than stringing them together in running text, as we did above: like so -
To spring the trap:
say "'Sproing!' go the hinges and, with a flash of silver, the enormous blades whisk together!";
end the game in death.
Inform allows us to use whatever conventions of layout we prefer.
This chapter is about how to define more complicated phrases, and about the special phrases which exist to repeat the same activity over and over, to test conditions and so on.
Previous | Contents | Next |