I7: Problem with Understanding

[code]“Street Crossing” by Me

This Side is a Room. That Side is south of This side.

Understand the command “cross street” as something new. Understand the command “cross the street” as something new.
Understand “cross street” as going south when the location is This Side.
Understand “cross street” as going north when the location is That Side.[/code]

This does not compile – evidently, it is not understanding the “understand” statements. Section 16.17 of the Documentation indicates that it is possible to restrict an “understand” statement to a particular location.

Any ideas on what I’m doing wrong?


Robert Rothman

I don’t think you can do it that way. I would try something like

[code]Crossing the street is an action applying to nothing.
Understand “cross street” or “cross the street” as crossing the street.

Instead of crossing the street, say “But you don’t see a street!”

Instead of crossing the street when the location is this side, try going south.
Instead of crossing the street when the location is that side, try going north.

I think kanato is right; the problem is with “going north” – you have to have a plain action name, not an action plus a noun. (Take out the “when” clause and it still fails to compile.)


Robert Rothman

In general, I would recommend against creating new actions that include the intended noun. If the street is a scenery object (which it should be, so that it can be examined, if nothing else), then it would be better to create a new crossing action, which you would rule out in a check rule as a general thing. By default, Inform thinks “cross” is a synonym for “enter,” which is fairly bizarre. So you might try something along these lines:

[code]The sidewalk is a room. “The street runs east and west here. You’re on the north side.”

The southern promenade is south of the sidewalk. “The street runs east and west here. You’re on the south side.”

The street is a backdrop. It is in the sidewalk and the southern promenade. “It’s not too busy. You could probably cross safely.”

Understand the command “cross” as something new.

Crossing is an action applying to one thing and requiring light. Understand “cross [something]” and “traverse [something]” as crossing.

Check crossing:
say “That’s not something you can cross.”

Instead of crossing the street:
if the location is the sidewalk:
try going south;
try going north.[/code]