Chapter 11: Phrases
11.4. Conditions and questions

A variety of "conditions" have already appeared in this documentation. A condition is a phrase which describes a situation which might be true, or might be false, and examples might include:

Mr Kite is in Bishopsgate
the score is greater than 10
Sherlock Holmes suspects a woman

These are all examples of sentences, formed by putting nouns either side of a verb, and clearly a wide range of conditions can be written this way. But there are also a few special conditions built into Inform which have a fixed wording, and test questions difficult to address with ordinary sentences. For instance, the condition

in darkness

(e.g., "if in darkness...") tests whether the player is currently in the dark, and this is better than the more obvious-looking

the player is in a dark room

since the player might have a torch, or be inside a cage which is itself in a dark room, and so on. Another example of a condition not easily written as a sentence is

player consents

(e.g., "if the player consents...") which is unusual in doing something and not simply making a silent check: it waits for the player to type YES (or Y) or NO (or N) at the keyboard.

The outcome of conditions can be stored with the special kind of value called "truth state". In a way, these are the simplest of all values, because they can only be "true" and "false". We can obtain the truth state of any condition using "whether or not...":

let victory be whether or not all the treasures are in the cabinet;

We can then examine a truth state by comparing it against true or false:

if victory is true, ...

"Truth state" is a kind of value like any other, so for instance we could define a variable like so:

Salvation earned is a truth state that varies.

and it can similarly be used in table columns, and anywhere else where values are allowed.


169
** Example  Proposal
Asking the player a yes/no question which he must answer, and another which he may answer or not as he chooses.

RB


PreviousContentsNext