Chapter 16: Understanding
16.5. The text token

Most actions involve items: taking a vase, perhaps. As we shall see, they might also involve values, or a mixture of the two: turning a dial to 17 would involve both a thing (the dial) and a number (17). A few of Inform's built-in actions, however, can act on any text at all. For instance, asking the Sybil about the Persian army would involve a thing (the Sybil) and some text ("Persian army"). Inform does not try to understand automatically what that text might mean, or to relate it to any items, places or values it knows about: instead, Inform leaves that to the specific story to work out for itself, since the answer is bound to depend on the context. (In the chapter on Tables, we saw ways to compile tables of responses to particular topics of conversation.)

The token for "accept any text here" is just "[text]". For instance, if we create an action with:

Getting help about is an action applying to one topic.

We can then provide grammar for this action like so:

Understand "help on [text]" as getting help about.

When text like this is successfully matched, it is placed in a value called "the topic understood". (The term "topic" is used traditionally, really: most of the times one needs this feature, it's for a topic of conversation, or a topic being looked up in a book.)


285
* Example  Ish.
A (very) simple HELP command, using tokens to accept and interpret the player's text whatever it might be.

RB
286
** Example  Nameless
ASKing someone about an object rather than about a topic.

RB


PreviousContentsNext