Chapter 3: Place
3.1. Room Descriptions

The printing of a room description is a more delicate business than it might initially seem to be: Inform has to consider all the objects that the player might have brought into the room or dropped there, and all the objects on visible supporters, and decide how to group and list them.

All of this behavior is handled by the looking command, so we find the relevant rules in the carry out looking rulebook. To go through the elements step by step:

Looking begins by printing 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";
change the description of the Church to "The beams overhead have been burnt away and the pews are charred. Only the stone walls remain.";

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. For instance, to remove the name of the location entirely from room descriptions, we would write

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

(A word of 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.)

Ant-Sensitive Sunglasses demonstrates how to use activities to make more flexible room description text.

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". This is also the stage at which Inform chooses the order in which items will be listed.

We are allowed to meddle by changing the priorities of objects, in case we want some things to be described to the player first or last in the room description; Priority Lab goes into detail about how. We can also force things to be left out entirely: Low Light handles the case of an object that can only be seen when an extra lamp is switched on, even though the room is not otherwise considered dark. Copper River implements the idea of "interesting" and "dull" objects: the game determines which items are currently important to the puzzles or narrative and mentions those in the room description, while suppressing everything else.

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. More complicated uses of writing a paragraph abound. A developed system for handling supporters that don't list contents appears in The Eye of the Idol.

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:
        say "The watch catches your eye.";
        change the watch to not marked for listing.

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. For instance, Rip uses this activity to incorporate changeable or portable items into the main description text for a room when (and only when) that is appropriate.

The listing nondescript items activity 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.

These paragraphs can be manipulated with the printing the locale paragraphs description activity.

Another 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.

* See Looking for ways to change the default length of room descriptions


321
* Example  Ant-Sensitive Sunglasses
What are activities good for? Controlling output when we want the same action to be able to produce very flexible text depending on the state of the world -- in this case, making highly variable room description and object description text.

WI
344
* Example  Priority Lab
A debugging rule useful for checking the priorities of objects about to be listed.

WI
345
* Example  Low Light
An object that is only visible and manipulable when a bright light fixture is on.

WI
343
** Example  The Eye of the Idol
A systematic way to allow objects in certain places to be described in the room description body text rather than in paragraphs following the room description, and to control whether supporters list their contents or not.

WI

"The Eye of the Idol"

Section 1 - Reusable Material

We start by defining relations that let us know where items "belong", with the understanding that if something is where it belongs, it will be described in the main room description and therefore should not be separately listed. Thus:

Positioning relates various things to various things. The verb to be placed in implies the positioning relation. The verb to be placed on implies the positioning relation.

Room-positioning relates various things to various rooms. The verb to be room-placed in implies the room-positioning relation.

We can't make relations relate various objects to various objects, and rooms are not things, so two separate cases are necessary. An alternative approach would be to say "A thing has an object called the initial placement", which would allow a thing to have an initial placement that was a room, a supporter, or a container; an advantage of using relations, though, is that that way we can if we like specify multiple placements for the same object, so that, e.g., a sparkling diamond can be described in the main description paragraph as "half-buried in dust" in the beginning of the game, and then at the end as "in the eye of the idol" at the end.

Now we define, based on these relations, an "in-place" adjective, which will identify whether something is in a location which will specially describe it:

Definition: a thing (called prop) is in-place:
    if the prop is in the location and the prop is room-placed in the location, yes;
    if the holder of the prop is a thing and the prop is placed in the holder of the prop, yes;
    no.

Definition: a thing is out-of-place if it is not in-place.

With that done, removing these items automatically from the room description is actually pretty easy:

Before listing nondescript items:
    now every marked for listing in-place thing is not marked for listing.

One tricky case remains: when something is placed on a supporter that is scenery, it can be mentioned even if we have marked that object "not marked for listing". What matters here is not whether the object itself is marked for listing but whether the supporter has been "mentioned". (A fuller description of how room descriptions are assembled is available in the Looking section of the Commands chapter in the Recipe Book.) So let's also add a feature whereby we can easily suppress the descriptions of these supporters when appropriate:

A supporter can be quiet.

A quiet supporter is one that is never mentioned itself and which only mentions its contents if they are out of place. This allows for maximum flexibility in incorporating it into the body of room descriptions.

Rule for writing a paragraph about a quiet supporter (called chosen table):
    if an out-of-place thing is on the chosen table:
        if an in-place thing is on the chosen table,
            say "On [the chosen table], in addition to [the list of in-place things on the chosen table], [is-are a list of out-of-place things which are on the chosen table].";
        otherwise say "On [a chosen table] [is-are a list of out-of-place things which are on the chosen table].";
    now the chosen table is mentioned.

Notice that we can still override this with writing a paragraph rules about specific supporters in our game, if we decide that we want something a little different in some cases.

Now, an example to test this out:

Section 2 - A Sample Scenario

The Sand-Floored Chamber is a room. "The constant wind has filled this chamber with a layer of fine red sand, as soft as powder snow[if the diamond is in the Sand-floored Chamber]. Something sparkling is half-buried in the corner[end if]. A doorway lies open to the north."

The sparkling diamond is in the Sand-floored Chamber. The sparkling diamond is room-placed in the Sand-floored Chamber. The description is "It is a vast diamond; the front is faceted, the back smoothed to fit in some sort of socket."

The Hexagonal Temple is north of the Sand-Floored Chamber. "The temple walls are great ashlar blocks rising to a hundred feet overhead, perhaps more; the roof is a scarlet awning only, through which the sun filters down in blood hues. Overseeing all is a sculpture in stone and ivory[if the sparkling diamond is in the idol's eye], in whose single eye a vast diamond gleams[end if][mat-and-incense text].".

To say mat-and-incense text:
    if the mat is in the Temple and the incense stick is on the pedestal:
        say ". A prayer mat at the idol's feet, and an incense stick still burning on the pedestal, indicate that someone was only recently consigning her grievances to the care of the deity";
    otherwise if the mat is in the Temple:
        say ". At the idol's feet, some worshipper has left a prayer mat";
    otherwise if the incense stick is on the pedestal:
        say ". At the idol's side is a pedestal, on which incense still smolders".

We could have done all this with text conditions in the main room description, but it becomes difficult to read when there are too many conditions operating in the same text property, so we break it out into a clearer set of conditions.

The idol is scenery in the Hexagonal Temple. Understand "sculpture" or "stone" or "ivory" as the idol. The description is "The idol is perhaps three times the height of an ordinary man."

The idol's eye is part of the idol. It is a container. The description is "[if the diamond is in the idol's eye]It gleams with purpose and righteous wrath[otherwise]A round socket in the center of the idol's forehead from which something seems to be missing[end if]."

The pedestal is a quiet supporter in the Hexagonal Temple. On the pedestal is an incense stick. The incense stick is placed on the pedestal.

A mat is in the Hexagonal Temple. It is room-placed in the Hexagonal Temple. The description is "Woven of assorted grasses."

Test me with "get diamond / look / n / get mat / look / drop diamond / look / get diamond / put diamond in eye / look / get incense / look / drop mat / look / get mat / put mat on pedestal / look / put incense on pedestal / look".

341
* Example  Rip Van Winkle
A simple way to allow objects in certain places to be described in the room description body text rather than in paragraphs following the room description.

WI
348
*** Example  Copper River
Manipulating room descriptions so that only interesting items are mentioned, while objects that are present but not currently useful to the player are ignored.

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

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

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

WI


PreviousContentsNext