Look towards

[code]Understand “look [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, say “You can’t see anything promising that way.” instead;
try looking toward the viewed item.

Instead of facing up when outside:
say “Above you is bright sky.”

Understand “look toward [any adjacent room]” as looking toward. Understand “examine [any adjacent room]” as looking toward.

Looking toward is an action applying to one visible thing.

Carry out looking toward:
say “You make out [the noun] that way [location of the noun].”
[/code]

Sadly, that doesn’t work as much as I want. EVERYTHING (so far) seems to work fine BUT when carrying out looking toward, the “location of the noun” thing should be a compass direction.

“Location of foo” returns the room where foo is, and just plain “location” returns the location of the player. I’m not sure what it does when foo is itself a room, but it’s not what you want. If you want the direction that a room is in, try this:

say "You make out [the noun] to the [best route from the location to the noun]."

Ordinarily before trying to print this you would need to check that the best route is a direction (rather than nothing), but in your case you should have caught that before this stage since looking toward only works on adjacent rooms. (Though it might be kinder to the player to allow it to apply to any room and return a refusal if the room isn’t adjacent–as it is they’ll get a confusing parser error message, “That noun did not make sense in that context.”) If you have doors, you have to make sure they don’t mess things up.

By the way, your code for facing won’t work the way you want, because “look north” is already understood as an action, examining north. That previously existing Understand line overrides your new understand line. If you wanted to make a new action for “look north” you’d have to write

Understand the command "look" as something new.

and then write understand lines for every command involving “look,” including the lines from the Standard Rules for straight-up looking. (This is what that looks like in action–I had to eliminate an Understand line for “go” which meant zapping the grammar for “go” and all its synonyms and copying the lines I wanted from the Standard Rules.)

But in this case you don’t need to go through all that foofaraw, because you can just use the rules for examining directions to do what you want. Just change your “carry out facing” to “carry out examining a direction” (or “Instead of examining a direction”) and drop the business about facing.

Here’s a version with all that in; I also put the check for adjacency into a Check rule and the stuff that prints the text in a Report rule, because that’s a bit more Informy:

[code]Instead of examining a direction:
let the viewed item be the room noun from the location;
if the viewed item is not a room, say “You can’t see anything promising that way.” instead;
try looking toward the viewed item.

Instead of examining up when outside:
say “Above you is bright sky.”

Understand “look toward [any room]” as looking toward. Understand “examine [any room]” as looking toward.

Looking toward is an action applying to one visible thing.

Check looking toward:
if the noun is not adjacent:
say “You can’t see [the noun] from here.” instead.

Report looking toward:
say “You make out [the noun] to the [best route from the location to the noun].”

The prairie is a room. The meadow is west of the prairie. The glen is south of the meadow. The forest is east of the prairie. The cave is south of the forest.

To decide whether outside:
if the location is the cave, no;
yes.[/code]

Output: