Inform 7 Home Page / Documentation
§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 failure), 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.
|
ExampleMagneto'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...
|
|
"Magneto's Revenge"
The School for Gifted Youngsters is a room. Kitty Pryde is a woman in the School for Gifted Youngsters. "Kitty Pryde waits for you to say why you summoned her out of class." The description is "You see nothing special about Kitty Pryde. But that is only because she has learned to conceal her mutant powers: in fact she has the alternative name Shadowcat, and the ability to phase through solid objects."
The glass box is a container in the School for Gifted Youngsters. It is closed, openable, and transparent. In the box is a quantity of poisonous gas. In the box is a thing called the message from Magneto.
Instead of examining the message when the player is not carrying the message:
say "You'd need to be holding it before you could read it."
Instead of opening the glass box: say "You're deterred by the swirling bottle-green mist within."
Check someone taking the gas (this is the gaseous object rule): rule fails.
Unsuccessful attempt by someone taking the gas: say "The gas isn't something one can pick up in one's bare hands."
Every turn:
if the player can touch the gas:
say "The gas has reached your lungs!";
end the story.
A rule for reaching inside something:
if the person reaching is Kitty, allow access.
Persuasion rule for asking someone to try doing something: persuasion succeeds.
Test me with "get message / kitty, get message / open box / kitty, open box".
Now the player can get Kitty to take the message without releasing the poisonous gas:
Kitty Pride waits for you to tell her why you summoned her out of class.
You can also see a glass box (closed) (in which are some poisonous gas and a message from Magneto) here.
>kitty, get message
Kitty Pryde picks up a message from Magneto.
|
ExampleWaterworld
A backdrop which the player can examine, but cannot interact with in any other way.
|
|
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".
|
ExampleDinner 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.
|
|
"Dinner is Served"
Street in Kolonaki is a room. "There is a single round table out on the street here, and a window more or less at knee level looks down into the Olive Tree Gyro Shop, which is partly basement."
The Street contains a round table. The table is scenery. On the round table is a plate. On the plate are a gyro and a mound of fresh potates. The plate is portable. The potates and the gyro are edible. The description of potates is "They'd be called french fries, at home, but these are steak-cut and fried in olive oil." The description of the gyro is "Dripping garlic-yogurt sauce."
Olive Tree Gyro Shop is inside from Street in Kolonaki. Kostis is a man in the Gyro Shop. In the Shop is a stand. On the stand is a rotating column of cooking lamb flesh. In the shop is a closed, openable container called a drinks refrigerator. The refrigerator contains a can of Mythos beer and a can of Coke Light.
Here's the part that allows reaching through the window.
We replace the usual rule that says the player can never reach into a room with one that more specifically checks whether we are trying to reach through the window. If we aren't, we return the usual refusal. If we are, we return a custom refusal if the window is closed ("You can't reach through the closed window"), but allow access if the window is open.
The can't reach through closed window rule is listed instead of the can't reach inside rooms rule in the reaching inside rules.
This is the can't reach through closed window rule:
let reaching through the window be false;
if the container in question is a room and the container in question is not the location:
if the container in question is the Street and the location is the Olive Tree Gyro Shop:
now reaching through the window is true;
if the container in question is the Gyro Shop and the location is the Street:
now reaching through the window is true;
if reaching through the window is true:
if the window is closed:
say "You can't reach through the closed window.";
deny access;
otherwise:
allow access;
otherwise:
say "You can't reach into [the container in question] from here.";
deny access.
And the rest is window-dressing.
After looking when a room (called the next room) is adjacent:
try examining the next room.
Instead of examining a supporter, say "On [the noun] [is-are a list of things on the noun]." Instead of examining an open container, say "In [the noun] [is-are a list of things in the noun]."
The window is a backdrop. It is in the Street and the Shop. The window can be openable. The window can be open. The window is openable and closed. Instead of searching the window in the Street: try examining the shop. Instead of searching the window in the Shop: try examining the street.
Understand "examine [any adjacent room]" as examining.
Instead of examining a room:
say "Over in [the noun], you can see [a list of visible things in the noun]."
After deciding the scope of the player:
if the player is in the Street, place the Shop in scope;
if the player is in the Shop, place the Street in scope.
Test me with "examine shop / open refrigerator / open window / examine shop / open refrigerator / get beer / in / examine street / out / get gyro / close window / put gyro in refrigerator / open window / put gyro in refrigerator".