| Chapter 17: Activities |

| 17.21. 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.

The special phrase "place ... in scope" does what it suggests. 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; but we can also "place the box in scope, but not its contents" if we really need to place just the box itself in scope.

(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.

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

268
| 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".

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

270
| Example Stately Gardens An open landscape where the player can see landmarks in nearby areas, and automatically moves to interact with them.

> A map of linked rooms works well for modeling enclosed or indoor space, and somewhat less well for modeling large open spaces, where a person should reasonably be able to see things which are much too far away to touch. With some modifications to scoping, though, we can create an environment where objects in nearby rooms are described and viewable, and where the player will automatically move towards distant items before interacting with them physically. "Stately Gardens" Chapter 1 - Laying Out Rooms A room can be indoors or outdoors. Use full-length room descriptions. After deciding the scope of the player: repeat with the way running through directions begin; let first step be the room the way from the location; if the first step is a room begin; place the first step in scope; let second step be the room the way from the first step; if the second step is a room, place the second step in scope; end if; end repeat; place the obelisk in scope. The obelisk is so large that it can be seen from every room. If we had a number of such large monuments we might want to write a systematic routine to handle them, but this will do for now. The room description heading rule is not listed in the carry out looking rules. When play begins: change the left hand status line to "Idyllic"; change the right hand status line to " ". Now, we set things up so that the surrounding areas are described automatically as part of the room description: After looking when the location is an outdoors room: change count of sentences to 0; repeat with way running through directions begin; let space be the room way from the location; if space is an outdoors room, silently try looking toward space; end repeat; if the obelisk is not in the location and the obelisk is unmentioned begin; let the way be the best route from location to the Upper Terrace; if the way is a direction, say "[The obelisk] is proudly visible on [the way] horizon. [run paragraph on]"; increase the count of sentences by 1; end if; say paragraph break. But perhaps there are a few rooms where we do not wish that to happen, so we'll build in exceptions for those. After looking in the rose garden: say "Otherwise, you are quite cut off.". After looking in the Ha-ha: do nothing. And suppose we want to allow the player to look in any direction: Understand "look [direction]" or "look to/toward [direction]" as facing. Facing is an action applying to one visible thing. Carry out facing: let the viewed item be the room noun from the location; if the viewed item is not a room begin; if the location is indoors, say "Your view is restricted by the lack of doors or windows in that direction." instead; otherwise say "You can't see anything promising that way." instead; end if; try looking toward the viewed item. Instead of facing up: say "Above you is bright sky." We also need to tell distant rooms how to describe themselves. Understand "look toward [any adjacent room]" as looking toward. Looking toward is an action applying to one visible thing. Carry out looking toward: change the chosen direction to the best route from the location to the noun; change the second noun to the room the chosen direction from the noun; if the noun contains something mentionable begin; repeat with item running through mentionable things in the noun begin; carry out the writing a distant paragraph about activity with the item; end repeat; end if; if the noun contains something mentionable begin; increase the count of sentences by 1; choose row count of sentences in the Table of Distance Sentences; if the second noun is an outdoors room and the second noun contains something mentionable, say "[both entry] [run paragraph on]"; otherwise say "[here entry] [run paragraph on]"; otherwise; if the second noun is an outdoors room and the second noun contains something mentionable begin; increase the count of sentences by 1; choose row count of sentences in the Table of Distance Sentences; say "[there entry] [run paragraph on]"; end if; end if; And again, some exception needs to be made for seeing what's in the dip in the ground: Instead of looking toward the Ha-ha: change the chosen direction to the best route from the location to the noun; change the second noun to the room the chosen direction from the noun; if the second noun is an outdoors room and the second noun contains something mentionable begin; increase the count of sentences by 1; choose row count of sentences in the Table of Distance Sentences; say "[there entry] [run paragraph on]"; end if. This is arguably an unnecessary refinement, but the listing of items in the distance gets a bit repetitive unless we vary the sentence structure. Chosen direction is a direction that varies. Count of sentences is a number that varies. Table of Distance Sentences
> both | here | there
> "From here, you make out [a list of mentionable things in the noun] a little way [chosen direction], and, further on, [a list of mentionable things in the second noun]." | "From here, you make out [a list of mentionable things in the noun] [if the noun is not adjacent to the location]some distance [end if]to [the chosen direction]." | "From here, you make out [a list of mentionable things in the second noun] some distance [chosen direction]."
> "To [the chosen direction] there [is-are a list of mentionable things in the noun], partly obscuring your further view of [a list of mentionable things in the second noun]." | "To [the chosen direction] there [is-are a list of mentionable things in the noun]." | "Quite a way [chosen direction] [is-are a list of mentionable things in the second noun]."
> "Then [chosen direction] [is-are a list of mentionable things in the noun], and beyond [a list of mentionable things in the second noun]." | "Meanwhile, to [the chosen direction] [is-are a list of mentionable things in the noun]." | "Meanwhile, [chosen direction] in the middle distance [is-are a list of mentionable things in the second noun]."
> "When you turn [chosen direction], you see [a list of mentionable things in the noun], and somewhat further on [a list of mentionable things in the second noun]." | "When you turn [chosen direction], you see [a list of mentionable things in the noun]." | "If you turn [chosen direction], you see [a list of mentionable things in the second noun] some way off."
> "Somewhere generally [chosen direction] [is-are a list of mentionable things in the noun], beyond which, [a list of mentionable things in the second noun]." | "Roughly [chosen direction] [is-are a list of mentionable things in the noun]." | "Moreover, in the [chosen direction] distance [is-are a list of mentionable things in the second noun]."
> "[The chosen direction] shows [a list of mentionable things in the noun] and then [a list of mentionable things in the second noun]." | "And to [the chosen direction] [a list of mentionable things in the noun]." | "Meanwhile, [chosen direction] in the middle distance [is-are a list of mentionable things in the second noun]."
> "Then, [chosen direction], [is-are a list of mentionable things in the noun], and beyond [a list of mentionable things in the second noun]." | "Meanwhile, to [the chosen direction] [is-are a list of mentionable things in the noun]." | "Meanwhile, [chosen direction] in the middle distance [is-are a list of mentionable things in the second noun]."
> "Finally, [chosen direction], [is-are a list of mentionable things in the noun], somewhat nearer than [a list of mentionable things in the second noun]." | "Finally, to [the chosen direction] [is-are a list of mentionable things in the noun]." | "Finally, [chosen direction] in the middle distance [is-are a list of mentionable things in the second noun]."
Now, our ability to view things at a distance should be determined by the size of the things we're trying to see: Chapter 2 - Height A height is a kind of value. 10 feet 11 inches specifies a height. 10 feet 11 specifies a height. The verb to stand (it stands, they stand, it is standing) implies the height property. The verb to measure (it measures, they measure) implies the height property. A thing has a height. The height of a thing is usually 3 feet 0. Definition: a thing is tiny if its height is 0 feet 6 inches or less. Definition: a thing is short if its height is 3 feet 0 or less. Definition: a thing is tall if its height is 6 feet 0 or more. The height of a man is usually 5 feet 10 inches. The height of a woman is usually 5 feet 6 inches. Definition: a thing is monumental if it is taller than 25 feet 0 inches. Definition: a thing is mentionable if it stands tall enough to see. To decide whether (item - a thing) stands tall enough to see: if the item is in the Rose Garden and the item is shorter than the roses, no; if the item is mentioned, no; if the item is in an adjacent room and item is taller than 2 feet 0, yes; if the item is taller than 4 feet 0, yes; no. Instead of examining something which is within a room (called the space) which is not the location: if the location is adjacent to the space begin; if the noun is tiny, say "It is too far from here for you to make out much detail about [the noun]." instead; let way be the best route from the location to the space; if the way is a direction, say "You gaze off [way] at [the noun]..."; continue the action; otherwise; if the noun is short, say "It is too far from here for you to make out much detail about [the noun]." instead; let way be the best route from the location to the space; if the way is a direction, say "You gaze off [way] into the distance at [the noun]..."; continue the action; end if. We might also want to be able to override, manually, the way distant things are described. Writing a distant paragraph about something is an activity. Rule for writing a distant paragraph about the lily pond: if the second noun is a room and something mentionable is in the second noun, say "A [lily pond], [chosen direction], patchily reflects [a list of mentionable things in the second noun] on the far side. [run paragraph on]"; otherwise say "To [the chosen direction], [a lily pond] shimmers in the sunlight. [run paragraph on]" Rule for writing a distant paragraph about the roses: if something in the Rose Garden is taller than the roses, say "Over the tops of [the roses], [chosen direction], you see [a list of mentionable things in the rose garden]. [run paragraph on]"; otherwise say "Immediately [chosen direction] is [the roses]. [run paragraph on]" Rule for writing a distant paragraph about the obelisk: if a mentionable thing in the Upper Terrace is shorter than the obelisk, say "A stupidly grand [obelisk], [chosen direction], towers over [a list of mentionable things in the Upper Terrace]. [run paragraph on]"; otherwise say "To [the chosen direction], you can't help noticing [the obelisk], which is much larger than any object really needs to be. [run paragraph on]". After writing a distant paragraph about something: increase the count of sentences by 1. Moreover, proximate things might have special descriptions too. Rule for writing a paragraph about something tiny when the location is outdoors: if the location is the Gravel Circle, say "Abandoned in the gravel [is-are a list of unmentioned tiny things in the location]. [run paragraph on]"; otherwise say "Half trampled into the grass, and easy to miss, [is-are a list of unmentioned tiny things in the location]. [run paragraph on]" Before doing something other than examining or approaching to something which is not within the location: if the player has the noun, continue the action; say "(first going over to [the noun])[line break]"; try approaching the noun; if the noun is not within the location, stop the action. Understand "go toward/to/towards/near [something]" or "approach [something]" as approaching. Approaching is an action applying to one visible thing. Check approaching: if the player is not in a room, say "You'll have to get up." instead; if the noun is within the location, say "You're as close to [the noun] as you can get." instead; let space be the location of the noun; if the space is not a room, say "You don't quite see how to get there." instead; let way be the best route from the location to the space; if way is a direction, do nothing; otherwise say "You can't see how to get over there from here." instead. To head to (space - a room): let the way be the best route from the location to the space; if the space is adjacent to the location, try going way; otherwise silently try going way. Carry out approaching: let space be the location of the noun; while the space is not the location repeatedly head to space. This is a bit primitive, since if we had an occasion where going was blocked, we could get stuck in a loop. So we would need to be careful, but for this example it won't arise. The description of a room is usually "[if going]You drift [noun] across the open lawn[direction relative to obelisk]. [end if]An absolutely phenomenal quantity of manicured turf stretches from where you stand in almost every direction." To say direction relative to obelisk: if obelisk is in the location begin; say ", as though drawn magnetically to the foot of the monument"; otherwise; let way be the best route from the location to the Upper Terrace; if way is the noun, say ", drawn towards [the obelisk]"; if the way is the opposite of the noun, say ", keeping [the obelisk] more or less at your back"; end if. Chapter 3 - The Grounds The Gravel Circle, the Ha-ha, the Sheep Field, the Open Lawn, the Croquet Ground, the Rose Garden, the Upper Terrace, the Middle Terrace, and the Lower Terrace are outdoors. The Middle Terrace is north of the Lower Terrace and south of the Upper Terrace. The lily pond is fixed in place in the Middle Terrace."You [if going]come to[otherwise]are at[end if] the north edge of a perfectly round lily pond, bordered with stones. Its surface patchily reflects [the marble anteater] on the south bank." A tent peg and a wilted orchid are in the Middle Terrace. The tent peg measures 0 feet 6. The orchid measures 0 feet 4. The description of the Lower Terrace is "[if going]You climb [noun] up a small hillock[direction relative to obelisk][otherwise]You stand on a short, round, entirely artificial hillock[end if]." The marble anteater is a fixed in place thing in the Lower Terrace. The height of marble anteater is 6 feet 2 inches."A marble anteater stands on a pedestal at the top of the hill. In the bright sunlight the white marble makes a striking contrast with [the obelisk] in the distance." The description is "The anteater is very much more than life-size." The obelisk of black granite is a fixed in place thing in the Upper Terrace."Now that you are at the foot of it, you can properly appreciate the stupid immensity of the obelisk, pointing stonily at heaven." The height of the obelisk is 50 feet 0 inches. The description of the obelisk is "It stands ridiculously tall, and has an inscription on the face." The inscription is part of the obelisk. The height of the inscription is 0 feet 3 inches. The description of the inscription is "You can't read the squirming, pointed letters, but they make you uneasy.". The Gravel Circle is west of the Upper Terrace, northwest of the Middle Terrace, and north of the Croquet Ground. The description of the Gravel Circle is "[if going]You head [noun] until the lawn thins and[otherwise]Here the lawn[end if] gives way to a circle of raked gravel, which crunches pleasingly beneath you." Instead of going northwest in the Upper Terrace, try going north. The Ha-ha is north of the Gravel Circle and northwest of the Upper Terrace. The description of the Ha-ha is "[if going]The land dips here so suddenly that you do not know the dip is there until you're in it; but it prevents livestock from crossing barriers, and that is the important thing[otherwise]You are at the base of a steep-sided depression, so the lawn continues north and south more or less at the level of your head[end if]. The tip of [the obelisk] is the only thing you can make out from this depression, off to the southeast.". North of the Ha-ha is the Sheep Field. In the Sheep Field is an animal called a black sheep. The black sheep stands 4 feet 3 inches."A black sheep grazes placidly nearby." The description of the black sheep is "It reminds you of your Uncle Tim." Before going from the Ha-ha: say "It's a bit of a scramble to get back up the side of the depression, and you keep slipping in the damp grass. But you manage at last." The Rose Garden is southwest of the Lower Terrace. The thicket of red roses is a fixed in place thing in the Rose Garden. The thicket stands 4 feet 2 inches."Heavy red roses grow over a roughly horseshoe-shaped wall around you. Over this barrier, the head of [the marble anteater] is visible to the northwest, and the tip of [the obelisk] in the distance." The description of the Rose Garden is "[if going]You slip [noun] into the enclosure of the rose garden. [end if]The rest of the park, and the world, seems muted and quiet." Instead of smelling the rose garden: try smelling the roses. Instead of smelling the roses, say "The smell tickles the back of your throat and makes you want to cough." Instead of listening to the rose garden: say "You can't hear anything at all." The Open Lawn is north of the Rose Garden, west of the Lower Terrace, and southwest of the Middle Terrace. The Croquet Ground is north of the Open Lawn, west of the Middle Terrace, southwest of the Upper Terrace, and northwest of the Lower Terrace. A discarded champagne cork is in the Open Lawn. It stands 0 feet 2 inches. A stone bench is an enterable supporter in the Croquet Ground. It stands 3 feet 8 inches."There is a stone bench here -- a sort of stone sofa, really, with nymphs disporting themselves on the arms and back." The description of the bench is "It used to be a Roman sarcophagus -- hence the nymphs -- but someone has thoughtfully recarved it as lawn furniture." The half-size Bentley is a vehicle in the Gravel Circle."A sort of child's-toy version of a Bentley is parked [if something parkable is in the location]beside [the tallest parkable thing in the location][otherwise]close at hand[end if]." The description of the half-size Bentley is "Of beautiful and unambiguously luxurious lines, but sized down to hold only one or (at a stretch) two people, and powered by electricity." The half-size Bentley stands 3 feet 6 inches. Definition: a thing is parkable if it is not a person and it is not the Bentley. Instead of touching the obelisk, say "Though it is black stone in sunlight, the obelisk is very cold to the touch." Test me with "s / s / e / sw / ne / n / n / w / n / n / examine obelisk / touch obelisk / read inscription".

Previous | Contents | Next