Inform 7 Home Page / Documentation


§10.3. Using the Scene index

But when we test the previous section's example, we find that after a brief wait, the train pulls up: but it never goes away again. We have given instructions on how the scene ends, but not when it ends, and as a result the scene goes on forever once started.

Even with simple story-lines, and this one could hardly be simpler, it is surprisingly easy to overlook something so that the whole story-line is derailed.

The Scenes page of the index is intended to help with this. The Plot section shows all of the scenes and how they are to begin, along with a key to the symbols used on it. One scene always included is "Entire Game", a special scene which, as its name implies, is always being played out. But if we look at the Scene index for the previous example, we will also see our Train Stop scene, and find that it is marked with the red warning symbol for "never ends". Let us fix this:

Train Stop ends when the time since Train Stop began is 3 minutes.

Note the useful value "time since Train Stop began":

time since (scene) began ... time

This phrase produces the time since the named scene began, which only makes sense, of course, if it has indeed begun. Example:

time since Entire Game began

time since (scene) ended ... time

This phrase produces the time since the named scene ended, which only makes sense, of course, if it has indeed ended. Example:

time since Formal Dinner ended

The actual times, in case they are needed, can be obtained with:

time when (scene) began ... time

This phrase produces the time (i.e., the value of the "time of day" variable) at the moment when the given scene began.

time when (scene) ended ... time

This phrase produces the time (i.e., the value of the "time of day" variable) at the moment when the given scene ended.

The testing command SCENES causes Inform to monitor the beginning and ending of scenes, and report on them. For instance:

>ask monk about lodging
"Welcome a poor traveler for the night?" you ask, rubbing your fingers together to restore a little feeling.

The monk looks you up and down for a moment and you sense his reaction hanging in the balance; then he slaps you on the back, hard enough to drive the air from your lungs. "In."

[Scene 'Greeting' ends]
The monk takes your elbow and pushes you imperiously toward dinner.
[Scene 'Banquet' begins]


arrow-up.png Start of Chapter 10: Scenes
arrow-left.png Back to §10.2. Creating a scene
arrow-right.png Onward to §10.4. During scenes

*ExampleAge of Steam
The railway-station examples so far put together into a short game called "Age of Steam".