| Chapter 16: Understanding |

| 16.1. Understand

During play, the computer and the player alternate in writing messages to each other: in the player's case, these are short instructions, usually saying what to do next. A wide range of such "commands" are automatically understood, but these only apply to the standard built-in actions. (This wide range is conveniently tabulated at the foot of the Actions index.) If we want the player to be able to command new actions, then we need to specify what is to be understood as what. For this, we supply special sentences starting with the word "Understand".

Suppose we return to the earlier example of a newly created action:

> Photographing is an action applying to one visible thing and requiring light.

We then supply lines of grammar (as they are called) for Inform to recognise, like so:

> Understand "photograph [someone]" as photographing.

> Understand "photograph [an open door]" as photographing.

As usual, the square brackets indicate something which stands for text, rather than text to be taken verbatim. "[someone]" needs to be the name of anything of the kind "person", for instance (though as usual that person will need to be in sight of the player for the name to be accepted). The first word - in these examples "photograph" - must be something definite, not a substitution like this.

For obvious reasons, this pattern of words needs to match the expectations of the action. Photographing applies to "one visible thing" - the "visible" just means it does not need to be touched, only seen - so neither of these would be allowable:

> Understand "photograph" as photographing.
> Understand "photograph [someone] standing next to [something]" as photographing.

The first is bad because it supplies no things at all, the second because it supplies two: what we want, of course, is just the one.

221
| Example XYZZY Basics of adding a new command reviewed, for the case of the simple magic word XYZZY.

222
| Example Indirection Renaming the directions of the compass so that "white" corresponds to north, "red" to east, "yellow" to south, and "black" to west.

In Mayan culture, colours seem to have been used as names for the primary directions: for instance, "red" implies east as the colour of sunrise. So the following might be a stylish touch for a game in which the player has to get inside the Mayan world-view: "Indirection" Understand "white" and "sac" as north. Understand "red" and "chac" as east. Understand "yellow" and "kan" as south. Understand "black" and "chikin" as west. We could also use a colour as a verb: Understand "turquoise" and "yax" as looking. And now a few extra rooms to try it out in: The Square Chamber is a room. "A sunken, gloomy stone chamber, ten yards across. A shaft of sunlight cuts in from the steps above, giving the chamber a diffuse light, but in the shadows low lintelled doorways to east and south lead into the deeper darkness of the Temple." The Wormcast is east of the Square Chamber. The Corridor is south of the Square Chamber. Test me with "kan / white / chac / black".

223
| Example Xylan Creating a new command that does require an object to be named; and some comments about the choice of vocabulary, in general.

Previous | Contents | Next