ยง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.
| ExampleSpellbreaker P. David Lebling's classic "Spellbreaker" (1986) includes a room where the game cannot be saved: here is an Inform implementation.
|
|
The answer is easy, but there is a trap:
Check saving the game when the location is the Vault: say "That spell does not work here." instead.
The trap is that "Before saving the game...", which might have been our first guess, does not work: because out of world actions are exempt from Before, Instead and After rules.
"Spellbreaker" pulls this unpleasant, but in context witty, stunt as part of a situation which is engineered to force the player to reason through a weighing-objects puzzle using the perfect strategy rather than by guesswork. The illusion that the situation is fair - not rigged against the player, that is - would collapse if the player could save the game and keep retrying possibilities in the light of knowledge gained from earlier attempts. The moral of this story is that any attempt to use in-world situations to influence out-of-world commands should be extremely uncommon.
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.