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

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

> This time we're going to assume that the player can see into any room that is on a line of sight within one or two steps of travel. "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: let first step be the room the way from the location; if the first step is a room: 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; 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. Now, we set things up so that the surrounding areas are described automatically as part of the room description: Building description is a truth state that varies. Building description is false. After looking when the location is an outdoors room: now count of sentences is 0; now building description is true; repeat with way running through directions: let space be the room way from the location; if space is an outdoors room, silently try looking toward space; if the obelisk is not in the location and the obelisk is unmentioned: 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]"; increment the count of sentences; now building description is false; 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: 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; 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. Check looking toward a room which does not contain something mentionable: if building description is false: say "You can't make out anything of interest that way." instead. Carry out looking toward: now the chosen direction is the best route from the location to the noun; now the second noun is the room the chosen direction from the noun; if the noun contains something mentionable: repeat with item running through mentionable things in the noun: carry out the writing a distant paragraph about activity with the item; if the noun contains something mentionable: increment the count of sentences; 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: increment the count of sentences; choose row count of sentences in the Table of Distance Sentences; say "[there entry] [run paragraph on]". 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: now the chosen direction is the best route from the location to the noun; now the second noun is the room the chosen direction from the noun; if the second noun is an outdoors room and the second noun contains something mentionable: increment the count of sentences; choose row count of sentences in the Table of Distance Sentences; say "[there entry] [run paragraph on]". The following is to account for cases where the player types "look toward obelisk" or similar, rather than looking toward a room: Understand "look toward [something]" as examining. The following 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: 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. 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: increment the count of sentences. 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; unless way is a direction, 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: 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. Going state is a truth state that varies. Going state is false. Check going: now going state is true. The description of a room is usually "[if going state is true]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." Before reading a command: now going state is false. To say direction relative to obelisk: if obelisk is in the location: 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". Chapter 3 - The Grounds When play begins: now the left hand status line is "Idyllic"; now the right hand status line is " ". 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 state is true]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 state is true]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 state is true]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 state is true]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 state is true]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 "look east / look toward obelisk / s / s / e / sw / ne / n / n / w / n / n / examine obelisk / touch obelisk / read inscription".

Previous | Contents | Next