12.18. Changing reachability

| Chapter 12: Advanced Actions |

| 12.18. Changing reachability

The question of what the player can, and cannot, reach to touch is important in interactive fiction. It contains some of the subtlest ideas in the model world, though they often go unnoticed. For instance, if a key is on a shelf which is part of a closed box, can we reach for the key? This comes down to whether the shelf, described only as "part of" the box, is on the inside or the outside: and in fact, because it cannot know which is the case, Inform allows either. So in general it is best to regard "parts" as being exterior parts, but to avoid having parts on containers that might in the course of play be closed up with the player inside.

We can, if we wish, change the principles of what can be touched by writing new reaching inside or reaching outside rules. Returning to the example of the conical flask:

> A rule for reaching inside the flask: say "Your hand passes through the glass as if it were not there, chilling you to the bone."; allow access.

(Or this could equally be called "a reaching inside rule for the flask".) More generally, we could give the usual flexible description of what the rule applies to:

> A rule for reaching inside open containers: say "Your hands seem enigmatically too large for [the container in question]."; deny access.

The "container in question" is the one to which the rule is being applied. Note that a reaching inside rule can "deny access" (stopping with fail), or "allow access" (stopping with success), or neither, in which case the decision is left up to any subsequent rules in the rulebook to make. If none of them decide, access is allowed.

If it seems possible that these rules will be employed by people other than the player, then we need to write them a little more carefully, and in particular we need to ensure that they print nothing for other people. In the first case below, anybody can reach through the glass; in the second case, only the player cannot reach into open containers.

> A rule for reaching inside the flask:
> if the person reaching is the player, say "Your hand passes through the glass as if it were not there, chilling you to the bone.";
> allow access.

> A rule for reaching inside open containers:
> if the person reaching is the player:
> say "Your hands seem enigmatically too large for [the container in question].";
> deny access.

The "person reaching" is, as its name suggests, the person trying to reach through the barrier in question.

215
| Example Waterworld A backdrop which the player can examine, but cannot interact with in any other way. |
RB

It's tempting to handle the player's inability to interact with something with a simple instead rule: "Waterworld 1" A view is a kind of backdrop. Instead of doing something other than examining to a view, say "You are too far from [the noun] to do anything but look." The sun is a view. It is everywhere. The description is "A blazing sun makes you wish you had never been born." The Sahara is a room. North of the Sahara is More Sahara. North of More Sahara is Yet Further Sahara. Test me with "x sun / get sun / n / x sun / n / x sun". Unfortunately, the rule does not address the case where the object in question is the second noun; so for instance the following example reveals the difficulty: "Waterworld 2" A view is a kind of backdrop. Instead of doing something other than examining to a view, say "You are too far from [the noun] to do anything but look." The player carries a rope. The sun is a view. It is everywhere. The description is "A blazing sun makes you wish you had never been born." The Sahara is a room. North of the Sahara is More Sahara. North of More Sahara is Yet Further Sahara. Test me with "x sun / get sun / n / x sun / n / x sun / tie rope to the sun". ...where the response here behaves as though the sun is in reach. If we had a fully implemented tying action, the player would (even more disastrously) be allowed to lasso celestial objects. We could add a second instead rule as well: "Waterworld 3" A view is a kind of backdrop. Instead of doing something other than examining when the noun is a view: say "You are too far from [the noun] to do anything but look." Instead of doing something other than examining when the second noun is a view: say "You are too far from [the second noun] to do anything but look." The player carries a rope. The sun is a view. It is everywhere. The description is "A blazing sun makes you wish you had never been born." The Sahara is a room. North of the Sahara is More Sahara. North of More Sahara is Yet Further Sahara. Test me with "x sun / get sun / n / x sun / n / x sun / tie rope to sun". This produces acceptable output again, but there is a more elegant way, one that works better with Inform's existing world model. Currently the default model assumes that accessibility -- whether the player can reach something or not -- is checked between the Before... rules and the Instead... rules. We can add our own accessibility rules, including this one to govern whether views are accessible. So for instance: "Waterworld 4" A view is a kind of backdrop. The can't touch views rule is listed before the access through barriers rule in the accessibility rulebook. Accessibility rule (this is the can't touch views rule): if the action requires a touchable noun and the noun is a view: say "You are too far from [the noun] to do anything but look." instead; if the action requires a touchable second noun and the second noun is a view: say "You are too far from [the second noun] to do anything but look." instead; The player carries a rope. The sun is a view. It is everywhere. The description is "A blazing sun makes you wish you had never been born." The Sahara is a room. North of the Sahara is More Sahara. North of More Sahara is Yet Further Sahara. Test me with "x sun / get sun / n / x sun / n / x sun / tie rope to sun". Now our new accessibility rule fits into its proper stage. A more extensive implementation of distant objects, appropriate for use with active other characters as well as the player, and more options for special cases, is available as an extension for Inform.

216
| Example Magneto's Revenge Kitty Pryde of the X-Men is able to reach through solid objects, so we might implement her with special powers that the player does not have... |
RB

217
| Example Dinner is Served A window between two locations. When the window is open, the player can reach through into the other location; when it isn't, access is barred. |
RB

Previous | Contents | Next