Inform 7 Home Page / Documentation


§9.5. Every turn

The passage of time in interactive fiction is broken up into a succession of turns, in each of which the player types a request and is given a response. Usually each such request triggers one action, but sometimes a whole sequence are fired off, as when the player types "get all" in a cluttered room.

As we've seen, the variable "turn count" holds the number of turns of play so far. By convention turn number 0 is the time when Inform prints up the banner and any initial text; it becomes turn number 1 when the player's first command is typed.

One of the last things to happen in each turn is that Inform will apply any rules which have been set to occur "every turn", like so:

Every turn, say "The summer breeze shakes the apple-blossom."

This is equivalent to writing:

An every turn rule: say "The summer breeze shakes the apple-blossom."

Note that the text about blossom, which will quickly become tiresome, is said at the end of every turn, not at the beginning, and in particular not before the player's first opportunity to type a command.

As usual when defining rules, we can add stipulations: any condition can be attached using "when".

Every turn when the location is the Orchard, say "The summer breeze shakes the apple-blossom."

Every turn when the player can see the rotting fish, say "Your nose twitches involuntarily."


arrow-up.png Start of Chapter 9: Time
arrow-left.png Back to §9.4. When play ends
arrow-right.png Onward to §9.6. The time of day

***ExampleWitnessed 1
A kind of battery which can be put into different devices, and which will lose power after extended use.

****ExampleText Foosball
A game of foosball which relies heavily on every-turn rules.