Chapter 6: Commands
6.1. Looking

Looking is one of the most complicated commands built into Inform, with a large number of things one might want to change.

Looking prints the name and description of the room we're in. We can introduce variations into room names and descriptions by changing their printed name and description properties, as in

change the printed name of the Church to "Lightning-Struck Ruin";

If we need more drastic effects, we can turn off or change either of these features by altering the rules in the carry out looking rulebook.

Next, the game determines what items are visible to the player and need to be described. These never include the player himself, or scenery, but other things in the environment will be made "marked for listing".

Then Inform carries out the writing a paragraph about... activity with anything that provides one; anything it prints the name of, it tags "mentioned". Thus

Rule for writing a paragraph about Mr Wickham:
    say "Mr Wickham looks speculatively at [list of women in the location]."

will count Wickham and everyone he looks at as all having been mentioned, and will not refer to them again through the rest of the room description.

Inform then prints the initial appearances of objects that are marked for listing but not already mentioned; and then it performs the listing nondescript items activity, collating the remaining objects into a paragraph like

You can see a dog, a hen, ...

We can pre-empt items from appearing in this paragraph or change their listing by intervening with a Before listing nondescript items... rule, as in

Before listing nondescript items when the player needs the watch:
    if the watch is marked for listing begin;
        say "The watch catches your eye.";
        change the watch to not marked for listing;
    end if.

If we wanted the watch always to be listed this way, it would be better to give it an initial appearance, but for conditional cases, the listing nondescript items activity is a good place to intervene. It also allows us to replace the "You can see..." tag with something else more fitting, if for instance we are in a dimly lit room.

When the game compiles the list of nondescript items, it adds tags such as "(open)" or "(empty)" or "(on which is a fish tank)" to the names of containers and supporters. We can suppress or change the "(empty)" tag with the printing room description details of activity, as in

Rule for printing room description details: stop.

And we can suppress the "(open)" and "(on which is...)" sorts of tags with the "omit the contents in listing" phrase, as in

Rule for printing the name of the bottle while not inserting or removing:
    if the bottle contains sand, say "bottle of sand";
    otherwise say "empty bottle";
    omit contents in listing.

Finally, the looking command lists visible non-scenery items that sit on scenery supporters, as in

On the table is a folded newspaper.

It is at the moment slightly vexing to change the output of this line - a matter we hope to improve in future versions of Inform. One somewhat inelegant but effective way around it is to make the table not scenery after all, but merely fixed in place, and then to control output with a writing a paragraph about sentence, thus:

Parlor is a room. The table is in Parlor. On the table is a folded newspaper.

Rule for writing a paragraph about the table:
    if the folded newspaper is on the table, say "Your newspaper is folded neatly on the end table.";
    otherwise now the table is mentioned.

Replacing that with just

Rule for writing a paragraph about the table:
    now the table is mentioned.

will prevent the game from describing the table or anything that is on it.

One common thing we may want to do is change the description of a room depending on whether we've been there before (as in Slightly Wrong) or on how often we've visited (as in Infiltration). Night Sky, meanwhile, changes the description of a room when we've examined another object, so that the player's awareness of his environment is affected by other things the character knows.

Verbosity changes the default behavior that rooms are described fully only the first time the player visits.

* See Going, Pushing Things in Directions for ways to change just those room descriptions that are shown as the result of the player's movement


3
** Example  Slightly Wrong
A room whose description changes slightly after our first visit there.

WI
139
* Example  Infiltration
A room whose description changes depending on the number of times the player has visited.

WI
135
* Example  Night Sky
A room which changes its description depending on whether an object has been examined.

WI

Sometimes a nice effect is to change the way things are described depending on the information the player has gained in the course of play. We could for instance write this:

"Night Sky"

The Planetarium is a room. "[if we have examined the sinister message]A dark room where it seems something is about to jump out at you![otherwise]A tranquil dark room with a ceilingful of stars.[end if]"

The sinister message is a thing in the Planetarium. "A message is taped to the wall." The description is "'BEWARE.'"

Test me with "look / x message / look".

On the other hand, beware that this would not work as desired:

"Night Sky"

The Planetarium is a room. "[if we have listened to the sinister message]A dark room where it seems something is about to jump out at you![otherwise]A tranquil dark room with a ceilingful of stars.[end if]"

The sinister message is a thing in the Planetarium. "A message plays very softly, so that you would have to listen to hear it." Instead of doing anything other than listening to the message: say "It's only a sound, after all.". Instead of listening to the sinister message: say "A voice whispers, 'BEWARE'."

Test me with "listen to message / look".

The reason is that our Instead rule has pre-empted normal listening, so Inform considers that we have never successfully heard the message. The moral here is that "if we have..." is useful for tracking events that otherwise proceeded completely normally (picking up ordinary objects, examining things); if we have used instead to make some change, we will have to use a different approach to record that the event did occur as scheduled.

2
* Example  Verbosity
Making rooms give full descriptions each time we enter, even if we have visited before.

WI


PreviousContentsNext