Thanks to some extensive efforts to clarify this by @drpeterbatesuk, I’ve come to understand that something being “in scope” effectively means that the parser will try to match words of player input to it when generating a command. If an object is not in scope, it can’t be the noun
or second noun
of an action, or the person asked
for a command to an NPC.
Scope is by default driven by the visibility relation
per the spatial model provided by the Standard Rules. Scope can be modified with rules related to the deciding the scope of...
activity.
The parser checks the words of player input against all objects determined to be in scope. Use of the keyword any
in a grammar line for an action, e.g. Understand "consider [any thing]" as considering.
for a hypothetical considering
action, lets the parser alter the scope for the purposes of evaluating that grammar line only. (I think.)
You want generic changes in scope, so the rule-based approach is probably best. You probably want to use the phrase place the contents of <room> in scope
though – otherwise the room object itself is placed in scope, which is atypical.
In addition to basic questions of scope, the parser will eliminate objects from consideration if they don’t match the profile specified by the grammar line. As an example, the someone
keyword requires that the matched object be a person
, so Understand "chat with [someone]" as chatting.
won’t let the command >CHAT WITH MAILBOX parse as the action chatting with the mailbox
unless the mailbox is a person
(or another person
-derived kind), or unless there is a person
whose name matches (e.g. a person called a mailbox repair technician
) that is in scope. Things added to scope count as “visible” in the narrow sense seen in action definitions such as Considering is an action applying to one visible thing.
; note that this is not exactly the same sense of visible as the visible
adjective defined by the Standard Rules, which relies on the visibility relation
(i.e. the ability to see things according to the spatial model).
After the parser resolves scope and successfully matches a grammar line, an action is generated and the action processing rules
kick in. (These are the well-known Before
, Instead
, Carry out
, etc.) Just after the Before
rules are processed assorted lesser-known rulebooks kick in, most importantly here the one involving reachability. Any action that requires a touchable
object will fail if the object can only be seen by the actor. Many actions in the Standard Rules require this, sometimes perhaps unexpectedly. You will need to write rules to allow any exceptions to reachability that you want to enable. (This sort of thing will be an issue whether you set up the jail cell as a separate room or an enterable container.)
As Zed says, you can just make the cell into a container
and avoid the hassle of scope modification entirely. That approach probably fits better with the implicit world model used by Inform.
Speech-like actions (i.e. asking it about
, answering it that
and telling it to
) all require that the target of the spoken content be touchable
– this seems to be used as a proxy for modeling continuity of the air medium between the actor and the target, as the same applies to the listening
and smelling
actions. You’ll have to make some modifications so that talking with people in the cell will work.
Asking about is speech-like action.
Answering that is speech-like action.
Telling about is speech-like action.
A container can be porous.
The gaol is a locked enterable transparent porous fixed in place container in Sheriff's Office.
The player carries a brass key. The brass key unlocks the gaol.
A person called a jailbird is in the gaol.
Reaching inside something porous when speech-like action: [these require touchability, not just visibility]
allow access.
There are still more things to deal with to get the output to look “pretty,” but a rule for writing a paragraph about the gaol
will probably serve well for that purpose.
If you want to go the multiple rooms route, then similarly (and note that this is very close to RB Ex 366 “Rock Garden”):
Mutual visibility relates rooms to each other in groups. The verb to be clearly visible from means the mutual visibility relation.
The Jail Cell is clearly visible from the Sheriff's Office.
Definition: A room is expansive if it is clearly visible from a room that is not it.
After deciding the scope of the player when the player is in an expansive room:
repeat with R running through rooms clearly visible from the location:
place the contents of R in scope.
After looking while the player is in an expansive room:
repeat with R running through rooms clearly visible from the location:
carry out the printing the locale description activity with R;
continue the action.
Definition: A room is surveyed if it is clearly visible from the location.
Reaching inside a surveyed room when speech-like action:
allow access.