17.27. Deciding the scope of something

| Chapter 17: Activities |

| 17.27. Deciding the scope of something

1. When it happens. "Scope" is a term of art in interactive fiction programming: it means the collection of things which can be interacted with at any given moment, which depends on who you are and where you are. Commands typed by the player will only be allowed to go forward into actions if the things they refer to are "in scope". Inform also needs to determine scope at other times, too: for instance, when deciding whether a rule conditional on being "in the presence of" something is valid. It is a bad idea to say anything during this activity.

2. The default behaviour. Is complicated: see the Inform Designer's Manual, 4th edition, page 227. Briefly, the scope for someone consists of everything in the same place as them, unless it is dark.

3. Examples. (a) We very rarely want to forbid the player to refer to things close at hand, but often want to allow references to distant ones. For instance, a mirage of something which is not present at all:

> After deciding the scope of the player while in the Shrine: place the holy grail in scope.

Two different phrases enable us to place unusual items in scope:

place (object) in scope

This phrase should only be used in rules for the "deciding the scope of..." activity. It places the given object in scope, making it accessible to the player's commands, regardless of where it is in the model world. Examples: place the distant volcano in scope; place the lacquered box in scope, but not its contents; Ordinarily if something is placed in scope, then so are its parts and (in the case of a supporter or a transparent or open container) its contents; using the "but not its contents" option we can place just the box itself in scope.

place the/-- contents of (object) in scope

This phrase should only be used in rules for the "deciding the scope of..." activity. It places the things inside or on top of the given object in scope, making them accessible to the player's commands, but it does nothing to place the object itself in scope. (It might of course be in scope anyway, and if it is then this phrase won't remove it.) Example: place the contents of the lacquered box in scope; place the contents of the Marbled Steps in scope; Note that the object in question can be a room, as in this second example.

(b) Another useful device is to be able to see, but not touch, another room:

> The Cloakroom is a room. "This is just a cloakroom, but through a vague, misty mirror-window you can make out the Beyond." After looking in the Cloakroom, say "In the mirror you can see [list of things in the Beyond]."

> After deciding the scope of the player while in the Cloakroom: place the Beyond in scope.

> The Beyond is a room. Johnny Depp is a man in the Beyond.

(This must, however, also be a mirage, as at time of writing Mr Depp is alive and as well as can be expected following the reviews of "Charlie and the Chocolate Factory".) When a room is placed in scope, this is understood as placing its contents in scope rather than the room-object itself. So "place the Ballroom in scope" allows the player to talk about the dancers, the chamber musicians and so forth, but not to "EXAMINE BALLROOM" as such. (This is sensible because actions like examining apply to things: and a room, unlike a container or a supporter, is not a kind of thing.)

(c) In darkness, the scope of someone is ordinarily restricted to his or her possessions (and body), but we can override that:

> After deciding the scope of the player while in darkness: place the location in scope.

4. A note about actions. This activity takes place during the process of understanding the player's command, when the action that will take place is not fully known. So if the player types "TAKE SHOEBOX", this activity would happen when SHOEBOX is being examined for meaning. Inform knows the action it would be taking if the current line of command grammar were to be accepted, but it does not yet know to what objects that command would be applied. That means attaching a proviso like "... while taking a container" to a rule for this activity will cause the rule to have no effect - whereas "... while taking" would be fine.

349
| Example Scope for listening different from scope for seeing Using "deciding the scope" to change the content of lists such as "the list of audible things which can be touched by the player". |
RB

350
| Example Peeled Two different approaches to adjusting what the player can interact with, compared. |
RB

Suppose we have a situation where the player is in darkness, but is allowed to feel and interact with (except for examining) any large objects. In that case, we write a scope rule that puts those large objects into scope all the time, and trust the "requires light" aspect of verbs like examining to prevent the player from doing any actions that he shouldn't: "Peeled" A thing can be large or small. Before touching a large thing when in darkness: say "You grope for [the noun]..." After deciding the scope of the player: repeat with item running through large things in the location: place item in scope. Some generic surroundings are backdrop. They are everywhere. Understand "walls" or "wall" or "ceiling" or "ground" or "floor" or "area" or "room" or "here" as the generic surroundings. Instead of touching the generic surroundings: say "You encounter nothing extraordinary." Instead of touching the generic surroundings when in darkness: say "You try feeling your way around and reach [a list of large things in the location]." After deciding the scope of the player when in darkness: place the surroundings in scope. The Room of Mystery is a dark room. The bearskin rug is a large thing in the Room of Mystery. Instead of touching the rug: say "It feels furry!" The peeled grape is a small thing in the Room of Mystery. Instead of touching the peeled grape: say "Gosh, is that an eyeball?" Test me with "feel floor / feel rug / eat rug / examine rug / get grape". Sadly, because the grape is small, the player will never encounter this horror. Alternatively, suppose we have a situation in which the player can use one command to interact with a kind of thing that isn't normally in scope. It's usually most convenient to write the "understand" rule appropriately rather than use the scope activity. (Note that we define "inquiring about" as applying to one *visible* thing; otherwise we would be required to be able to touch the catsuit in order to inquire about it. More on this restriction may be found in the Advanced Actions chapter on the topic of visible, touchable, and carried things.) "Peeled" Mr Steed's Flat is a room. Understand "ask about [any subject]" as inquiring about. A subject is a kind of thing. The skintight catsuit is a subject. Inquiring about is an action applying to one visible thing. Carry out inquiring about something: say "'What can you tell me about [the noun]?' you demand. Mr Steed raises his eyebrows, but does not reply." Test me with "ask about catsuit / x catsuit". All this said, there do arise certain complex situations when we want an activity-specific scoping.

351
| Example Ginger Beer A portable magic telescope which allows the player to view items in another room of his choice. |
RB

352
| Example Rock Garden A simple open landscape where the player can see between rooms and will automatically move to touch things in distant rooms. |
RB

353
| Example Stately Gardens An open landscape where the player can see landmarks in nearby areas, with somewhat more complex room descriptions than the previous example, and in which we also account for size differences between things seen at a distance. |
RB

Previous | Contents | Next