[I7] which object is being tested by the reachability rules

Say I have a character on a high platform – like a wobbly stool – and I want the character to be unable to reach anything in the room when she’s on the stool, except for a light bulb.

A reachability rule for the wobbly stool:
    if the ___________ is the light bulb:
        allow access;
    otherwise:
        say "You'll have to get down from the stool first.";
        deny access.

What do I put in the blank? At the time that the reachability rules are checked, the light bulb might be the noun (UNSCREW THE LIGHT BULB) or it might be the second noun (TIE THE DENTAL FLOSS TO THE LIGHT BULB). What label does Inform use to mean “the item we’re trying to reach”?

You’d probably want to store the object in question in a global variable before you invoke the reachability rules.

Alternatively, you could change your reachability rulebook so that it is parameterized on the target, rather than on the stool, e.g. “A reachability rule for something (called the object-in-question) when the player is on the wobbly stool”.

Alternatively, you could look at the contents of the noun and second noun variables and try to make a guess based on their contents. (E.g., if there is no second noun, then the target is the noun. If there is a noun and a second noun, and the player carries the noun, then the target is the second noun.)

–Erik

Where does the reachability rulebook come from? I’m not familiar with it.

I think the “electrified” example (#397) covers this situation pretty well. You have to test the noun and the second noun separately using “the action requires a touchable noun/second noun” phrases.

inform7.com/learn/man/ex116.html#e116

Capmikee’s right, Michael. It looks like you’ve got the accessibility rule mixed up with the “reaching inside” and “reaching outside” rulebooks. The reaching rulebooks both use the deny / allow access outcomes, but accessibility doesn’t appear to. This seems to work:An accessibility rule when the player is on the wobbly stool: if the current action involves the light bulb: say "You'll have to get down from the stool first." instead.

This brings up something weird. I knew there was an accessibility rulebook, but when I was trying this out earlier, I got enough syntax errors that I thought I must be remembering wrong. So I went to the “rules” section of the index. Couldn’t find it. I searched the manual for “accessibility.” Nothing about the accessibility rulebook in chapters (I later found a mention of it in the change log, but still no documentation). Eventually this led me to an explicit mention of the rulebook in the “Waterworld” example, but why doesn’t this rulebook have its own section, and why doesn’t it show up in the index? There’s even a section of the “rules” tab called “How accessibility is judged,” but it doesn’t mention the accessibility rulebook.

Er, sorry, I mistyped. The reaching outside rules is in fact what I meant. This is what the code sample should have looked like:

Rule for reaching outside the wobbly stool: if the ___________ is the light bulb: allow access; otherwise: say "You'll have to get down from the stool first."; deny access.

Here’s a complete working example of what I’m trying to do:

[code]The Garage is a room. “The light bulb in the ceiling is burned out again, and all you have to stand on is that wretched stool. One day you’re going to break your neck on that thing.”

A light bulb is here. It is scenery.

The wobbly stool is here. It is a scenery, enterable supporter.

Instead of doing something when the current action involves the light bulb and the player is not on the wobbly stool:
say “You can’t reach the light bulb from here.”

A dental floss is here. The indefinite article is “some”.

Instead of tying the dental floss to something:
say “You loop the dental floss around [the second noun] and knot it tight.”;
now the dental floss is part of the second noun.

Rule for reaching outside the wobbly stool:
if the noun is the light bulb:
allow access;
otherwise:
say “You’ll have to get down off the wobbly stool first.”;
deny access.

Test me with “touch bulb / get on stool / touch bulb / get floss / get off stool / get floss / get on stool / tie floss to bulb”.[/code]

You can see the problem at move 8. The action fails because the light bulb is the second noun, not the noun.

I was hoping that there was some variable that stored what, exactly, the game is trying to reach each time the reaching rules are invoked. I suppose I can do something like this:

[code]if the current action involves something that is not stool-accessible, deny access.

Definition: a thing is stool-accessible if the wobbly stool does not enclose it and it is not the light bulb.[/code]

Too bad it’s so ugly and awkward.

It looks like the best way. I’d like to know more about the reaching outside rulebook, but it looks like it’s just not well defined for actions involving two nouns.

It’s interesting that these issues are coming up now. I’ve been thinking ahead to develop the plotline for a game I’m working on, and there will be a point where the player will need to hide inside a cabinet inside a room and reach outside the cabinet to place an object (which he carries) inside another object (which is on a table and which is pretty much the only thing outside the cabinet that he can reach). It will be a while before I’m ready to start coding that piece, but it looks like I’m going to have to face exactly the same issues.

Robert Rothman

Won’t

Rule for reaching outside the wobbly stool:
	if the noun is the light bulb or the second noun is the light bulb:
		allow access;
	otherwise:
		say "You'll have to get down off the wobbly stool first.";
		deny access.

work?

No, because as long as the action involves the light bulb, the rule will allow access every time, even if the other object should be out of reach. You’d get a transcript like this:

Oh, hey, I figured it out, sort of.

The name of the variable that I want is “item described”. Simply checking to see if “the item described is the light bulb” still doesn’t quite work, however, because the reaching outside rules apparently get checked for both the noun and the second noun every time, regardless of whether or not you actually have to reach outside of something to touch them. This means that if the action has two nouns, then eventually “the item described” will be something that isn’t the light bulb, and the action will fail even if both items were technically within reach.

So, for the curious, here’s how I ended up solving the problem:

[code]The Garage is a room. “The light bulb in the ceiling is burned out again, and all you have to stand on is that wretched stool. One day you’re going to break your neck on that thing.”

A light bulb is here. It is scenery.

The wobbly stool is here. It is a scenery, enterable supporter.

Instead of doing something when the current action involves the light bulb and the player is not on the wobbly stool (this is the can’t reach the light bulb rule):
say “You can’t reach the light bulb from here.”

The can’t reach the light bulb rule is listed first in the instead rules.

A dental floss is here. The indefinite article is “some”.

Instead of tying the dental floss to something:
say “You loop the dental floss around [the second noun] and knot it tight.”;
now the dental floss is part of the second noun.

Rule for reaching outside the wobbly stool:
if the item described is the light bulb or the item described is enclosed by the wobbly stool:
allow access;
otherwise:
say “You’ll have to get down off the wobbly stool first.”;
deny access.

Test me with “touch bulb / get on stool / touch bulb / get floss / tie floss to bulb / get off stool / get floss / tie floss to bulb / get on stool / tie floss to bulb”.[/code]

I suspected that it was “the item described,” but I couldn’t get the formulation quite right. It’s a bit counter-intuitive that you have to specify “enclosed by the wobbly stool” in a rule for reaching OUTSIDE the wobbly stool!