I’m making a version of “A View of Green Hills” (example 80), except instead of just printing the room name, I want it to print all the details of the room, just as if you’d carried out the LOOK action in the room (minus any triggered events caused by the player actually being there, of course). The room name and description are simple enough, but I’m stuck on how to print the contents of the room correctly.
[code]The field is a room. “A grassy field.” The player is in the field.
The forest is north of the field. “A thick forest.”
Some trees are in the forest.
A man called the suspicious-looking man is in the forest. “Skulking about under the trees is a suspicious-looking figure.”
The player is carrying the binoculars.
Looking toward is an action applying to one visible thing.
Understand “look [direction]” as looking toward.
Check looking toward:
if the binoculars are not touchable:
say “You don’t have your binoculars.” instead;
if the noun is not a direction:
say “You must specify a direction to look.” instead.
Carry out looking toward:
let the viewed room be the room noun from the location;
if the viewed room is not a room:
say “The winter forest is deceptively still.”;
try looking adjacent to the viewed room.
Looking adjacent to is an action applying to one visible thing.
Understand “look toward [any room]” as looking adjacent.
Check looking adjacent to:
if the noun is not a room, say “You must specify a location to look toward.” instead;
if the noun is the location, try looking instead;
if the noun is not an adjacent room, say “[The noun] is too far away.” instead.
Carry out looking adjacent to:
if the player is not holding the binoculars:
now the player is holding the binoculars;
say “You hold up your binoculars.”
Report looking adjacent to:
say “Peering through your binoculars, you see the [the noun] region.[paragraph break]”;
say “[the description of the noun]”.[/code]