§12.15. Out of world actions

The actions seen so far are all impulses causing the protagonist inside the fictional world to do something, or at least try to. But when the player types "quit" or "save", that is not a request for anything to happen in the fictional world: it is an instruction to the program simulating that world. In fact, just the same, such requests are treated as actions, but of a special category called "out of world" actions. They do not cause time to pass by, so the turn counter does not advance, nor does this command cycle count as a turn at all; and they are altogether exempt from "Before", "Instead" and "After" rules. Only the player is allowed to try them.

We can also create new out-of-world actions. Suppose we want a dialogue like so:

>ROOMS
You have been to 1 out of 8 rooms.

Here is a complete implementation:

Requesting the room tally is an action out of world.
Report requesting the room tally: say "You have been to [number of visited rooms] out of [number of rooms] room[s]."
Understand "rooms" as requesting the room tally.

It is important not to use "out of world" actions for anything affecting what goes on in the fictional world, or realism will collapse, and action-processing may also fail to work in the usual way. "Out of world" actions should be reserved for providing commands like ROOMS, which monitor events rather than participate in them.


arrow-up.pngStart of Chapter 12: Advanced Actions
arrow-left.pngBack to §12.14. Actions for any actor
arrow-right.pngOnward to §12.16. Reaching inside and reaching outside rules

*ExampleSpellbreaker
P. David Lebling's classic "Spellbreaker" (1986) includes a room where the game cannot be saved: here is an Inform implementation.

Here is one way to score this point with Inform:

Check saving the game for the first time: decrement the score.

That has the right effect, but it just isn't sneaky enough. Instead let us quietly keep track of how many times the player saves:

Check saving the game: increment the number of saves.
When play ends: if the number of saves is 0, increment the score.

Sneakier, certainly, but now we could get the bonus even if the game ends earlier on, so finally:

When play ends: if the number of saves is 0 and the score is 349, increment the score.

***ExampleA point for never saving the game
In some of the late 1970s "cave crawl" adventure games, an elaborate scoring system might still leave the player perplexed as to why an apparently perfect play-through resulted in a score which was still one point short of the supposed maximum. Why only 349 out of 350? The answer varied, but sometimes the last point was earned by never saving the game - in other words by playing it right through with nothing to guard against mistakes (except perhaps UNDO for the last command), and in one long session.

Here is one way to score this point with Inform:

Check saving the game for the first time: decrement the score.

That has the right effect, but it just isn't sneaky enough. Instead let us quietly keep track of how many times the player saves:

Check saving the game: increment the number of saves.
When play ends: if the number of saves is 0, increment the score.

Sneakier, certainly, but now we could get the bonus even if the game ends earlier on, so finally:

When play ends: if the number of saves is 0 and the score is 349, increment the score.

Here is one way to score this point with Inform:

Check saving the game for the first time: decrement the score.

That has the right effect, but it just isn't sneaky enough. Instead let us quietly keep track of how many times the player saves:

Check saving the game: increment the number of saves.
When play ends: if the number of saves is 0, increment the score.

Sneakier, certainly, but now we could get the bonus even if the game ends earlier on, so finally:

When play ends: if the number of saves is 0 and the score is 349, increment the score.