Book S3 - Scope Hackery
Definition: a thing (called X) is local rather than nonlocal if the location of X is the location.
[Definition: a door is local rather than nonlocal if it is adjacent.]
After printing the name of a nonlocal thing (called X) while asking which do you mean: if the location of X is not nothing, say " in [the location of X]".
Understand "in [something related by reversed containment]" as a thing [when the item described is nonlocal].
Should the game suggest doing something with a nonlocal thing when the person asked is the player: it is a bad suggestion.
Should the game suggest doing something with a local thing when the nonlocal visibility flag is true and the person asked is the player: it is a passable suggestion.
Should the game suggest doing something with a nonlocal thing (called the item) when the person asked is not the player and the location of the item is the location of the person asked: it is a passable suggestion.
After deciding the scope of the player while parsing the nouns (this is the allow distant nouns if the actor can see them rule):
if the person asked is not the player:
let the place be the location of the person asked;
place the place in scope.
After deciding the scope of a marked in scope person (called the subject) (this is the allow other people to see the player rule):
place the location in scope.
The most recent actor is an object that varies.
After reading a command (this is the reset distant actor before multiple-command rule):
now the most recent actor is nothing. [This ensures we don't leave the actor in scope for multiple command-entries, only when multiple commands are entered on the same line.]
First persuasion (this is the reset most recent actor rule):
now the most recent actor is the person asked.
After deciding the scope of the player while parsing for persuasion (this is the multiple commands to a distant actor rule):[1]
if the most recent actor is not nothing:
place the most recent actor in scope, but not its contents.
A thing can be marked in scope. A thing is usually not marked in scope.
A room can be marked in scope. A room is usually not marked in scope.
The nonlocal visibility flag is initially false.
This is the re-cache scope at start of turn rule: recalculate scope.
The re-cache scope at start of turn rule is listed after the parse command rule in the turn sequence rulebook.
First every turn rule (this is the re-cache scope at end of turn rule): recalculate scope.
After deciding the scope of the player (this is the use cached scope if available rule):
repeat with the item running through marked in scope things:
place the item in scope, but not its contents;
repeat with the item running through marked in scope rooms:
place the item in scope, but not its contents.
The scope adjustment rules are a rulebook.
To recalculate scope:
now every thing is not marked in scope;
now every room is not marked in scope;
now the nonlocal visibility flag is false;
follow the scope adjustment rules.
Note
[1]. Without this rule, a command like FROBOZZ, EAST. WEST. would fail to parse because Frobozz wasn't in scope when the second command was parsed.