h1

Advanced Room Descriptions in I7

I wrote this page because I used field a fair number of questions about how to change specific aspects of room description in I7. There are some ways to make this more flexible overall (whence my room description extension, which throws more burden on the author but allows more control).

Most of these questions are now addressed in the Inform Recipe Book under Looking (or, if they involve movement, under Going); and in general I would now encourage people to use that where possible, since it includes updated references to the latest set of examples and so on. I am leaving this page up for the time being, though, in case anyone was used to looking things up in it.


First, a quick taxonomy:

Farmhouse …Room description heading
This is the farmhouse left to you by your Aunt Matilda when she died. …Room description body text

Fluffy sits on the ground, licking his fur. …Description produced by the initial appearance of an object

You can see a chocolate bar here. …List of generic objects in the room

The clock on the mantlepiece ticks. …Text produced by an every-turn rule after looking.

> …Prompt

Now, in theory, you might want to

1) eliminate any of these items;
2) have them print differently than they would by default;
or 3) print your own interstitial text between one piece and the next.

This article addresses systematically how to do these things.

All of these problems are in some way solvable by meddling with the rules belonging to the Looking action. Some have other solutions as well, some of which may be simpler, depending on what you’re trying to accomplish.


REMOVING
a) The room title.

With a rule:
If we want the titles of rooms never to print, the easiest way is to suppress the room title rule:

The room description heading rule is not listed in the carry out looking rules.

Warning: there is one other context in which the game prints a room name — when restoring a save or undoing a move. To omit the room title here too, add

Rule for printing the name of a room: do nothing.

This behavior is demonstrated in Glass.

b) The room description.

With properties:
One way would just be not to write any room descriptions, if we want to leave these out throughout the game.

With a rule:

The room description body text rule is not listed in the carry out looking rules.

c) The list of objects.

With activities:
We can meddle in the way this is printed with the listing nondescript items activity. By writing a new listing nondescript items rule, we can change the way in which items are listed (or replace it entirely). See the chapter on activities.

With a rule:

The room description paragraphs about objects rule is not listed in the carry out looking rules.


MODIFYING
a) The room title.

With properties:

The title printed for the name of the room is the printed name of the room. You can make this explicit with

The printed name of the Farmhouse is “Your Aunt Matilda’s Farmhouse”

and alter it in the middle of play with

change the printed name of the Farmhouse to…

or include a condition in the printed text:

The printed name of the Farmhouse is “[if Matilda is alive]Your Aunt Matilda’s Farmhouse[otherwise]Your Inherited Farmhouse[end if]“.

With activities:

The printed names of rooms, like the printed names of everything else, can be controlled with the printing the name activity, so:

Rule for printing the name of the farmhouse: …

With rules:

If needed, we can use procedural rules to override the old room description heading rule with a new one of our own devising, and include whatever we like:

The new room description heading rule is listed instead of the room description heading rule in the carry out looking rules.

b) The room description

With properties:

The text printed here is the description of the room. You can make this explicit with

The description of the Farmhouse is “Your Aunt Matilda’s Farmhouse”

and alter it in the middle of play with

change the description of the Farmhouse to…

or include conditions in it. See the example “Slightly Wrong” in the documentation.

With activities:

No activity governs this behavior by default. However, we can add one if we need to; see below:

With rules:

If needed, we can override the old room description body text rule with a new one of our own devising, and include whatever we like:

The new room description body text rule is listed instead of the room description body text rule in the carry out looking rules.

One thing to do is to use the new rule to add an activity. See the example “Crusoe” in the documentation for guidance on how to do this.

c) The list of objects

The listing of objects is the most complicated and automatic part of this process, so there are quite a number of ways we might wish to change this.

With activities:

We can meddle in the way object lists are printed:

  1. With the writing a paragraph about activity, we can craft special paragraphs; anything mentioned in these paragraphs will appear before the main object list and its existence will not be mentioned a second time.
  2. With listing nondescript items activities, we can adjust the way in which the lists of ordinary objects are presented.
  3. With the printing room description details activity, we can omit some information such as ” (empty)” from being appended to the names of containers, e.g. Note that this does *not* affect parentheticals listing subsidiary objects, so ” (which contains a live frog)” would not be removed by this activity.
  4. With the grouping things together activity, we can collect related objects in the list and modify the way they’re printed when together.
  5. With the printing the name activity, we can change the way specific items are named during room descriptions.

With a rule:

As we’ve seen, we can also add our own completely new rules for how to handle this task:

The new room description paragraphs about objects rule is listed instead of the room description paragraphs about objects rule in the carry out looking rules.

See the “Room Description Control” and “Tailored Room Description” extensions for one approach to completely replacing these.


ADDING INTERSTITIAL TEXT
a) Before the room title.

With action rules:

Suppose we want to print something after the player goes to a new room but before the room title and the rest of the description are printed. But we also need to make sure that the going action has succeeded, so Before going… would be a bad idea — in that case, it would run before checking for intervening doors or other impediments.
What we really want, then, is

After going to the Farmhouse:
say “You stroll toward the Farmhouse…”
continue the action.

If we want this to print only the first time, we can add “for the first time” or “when the Farmhouse is not visited” as a condition to the action.

With a rule:

We could also glue a new rule on before the room description heading rule, like so:

The room entry rule is listed before the room description heading rule in the carry out looking rules. This is the room entry rule: …

The effect would be a little different than the effect of the after… rule, since the room entry rule would fire every time we looked at a new room whether or not we had just traveled there. If we wanted to restrict ourselves only to cases of movement, we might add a condition such as “if going…” to whatever we say in this rule; in general, though, the action rule will be easier to specify in flexible ways.

b) Immediately after the room description and before the objects.

Here we want to print something after the room description is done and before the objects are listed. There are a couple of approaches to this.

With properties:

We could make the extra description a conditional part of the room description paragraph, like so: “This is your Aunt Matilda’s farmhouse[if the farmhouse is unvisited]. What a nice place[end if].”

With activities:

Writing a paragraph about activity: If our text has to do with an object in the room, we might try the writing a paragraph about activity: this will give it priority over the regular object descriptions.

With a rule:

We could also glue a new rule on before the room description paragraphs about rule, like so:

The pre-objects rule is listed before the room description paragraphs about objects rule in the carry out looking rules. This is the pre-objects rule: …

c) After the objects and before the every turn rules, if any.

Here we want to print something after all the rest of the room description has occurred, including any automatic object listing, but before any every turn rules fire in the room (since these might describe character behavior or other material that should be kept separate from the description).

With activities:

We could rely on after listing nondescript items of something, but the problem is that this will fire only if there are in fact nondescript items in the room to be described. An empty room would lose its special message as well.

With a rule:

We could also glue a new rule on after the other looking rules, like so:

The first time looking rule is listed after the consult LookRoutine entry point rule in the carry out looking rules.

If we only want this text to appear once, we could create a new room property like this:

Home is a room. “Your lovely home.” Outdoors is west of Home. “Outside your lovely home.”

A room has some text called the first-visit message. The first-visit message of a room is usually “blank”. The first-visit message of Outdoors is “It is nice to get some fresh air.”

A sausage is in Outdoors. A box of chocolates is in Outdoors.

The first time looking rule is listed after the consult LookRoutine entry point rule in the carry out looking rules.

This is the first time looking rule:
if the first-visit message of the location is not “blank”
begin;
say “[first-visit message of the location][paragraph break]“;
change first-visit message of the location to “blank”;
end if.

d) After the every turn rules and before the prompt.

Strictly speaking this is no longer part of the looking action, and the hooks are therefore different.

With activities:
Add a Before reading a command rule; see the chapter on Activities. Caveat: under current defaults, this will not occur before a disambiguation prompt, only before regular command prompts. (But that is probably what you want anyway.)

With rules:
Add a rule to the beginning of the turn sequence rules.