Inform 7 Home Page / Documentation
§18.25. Listing nondescript items of something
1. When it happens. This activity prints up the also-ran paragraph at the end of a room description. These are nondescript items because they don't merit paragraphs of their own: if, as sometimes happens, there are none in the room, then no such paragraph is printed and this activity does not happen. (So to add a further paragraph to a room description, a simpler "after looking" rule should be used, not an "after listing nondescript items" rule.)
2. The default behaviour. The paragraph ordinarily reads as "You can also see a cask and a clock." or similar. Before the activity begins, those objects which are nondescript - in this case the cask and the clock - are given the property of being "marked for listing".
If it turns out that nothing is marked for listing, because of before rules like the one in the example below, then nothing is printed and the activity is abandoned, so that the rules for and after are never reached.
3. Examples. (a) Promoting something out of the nondescript category, by unmarking it.
Before listing nondescript items:
if the watch is marked for listing:
say "The watch catches your eye.";
now the watch is not marked for listing.
(b) Changing the normal phrasing of the paragraph. Note that we can also change the listing style; the one below is the default.
Rule for listing nondescript items of the Distressingly Messy Room:
say "Strewn carelessly on the floor";
list the contents of the Distressingly Messy Room, as a sentence,
tersely, listing marked items only, prefacing with is/are,
including contents and giving brief inventory information;
|Start of Chapter 18: Activities|
|Back to §18.24. Writing a paragraph about|
|Onward to §18.26. Printing the locale description of something|
Rip Van Winkle
There are times when, for greater elegance of prose, we'd like to mention an object in the main body text of a room. For instance:
As we've already seen, that's no problem if Rip is scenery. He'll stay there motionless.
But what if something in the game allows Rip to wake up? Or what if we want to use the same technique on a portable object that the player should be allowed to take? Clearly in that case it's not appropriate to make the mentioned thing be scenery, and at the same time, we need to keep Inform from adding a superfluous
to the end of our description.
Here is how:
The Catskills is a room. "Here is a lovely, secluded fold in the mountains, far from civilization[if Rip Van Winkle is asleep]: as though to prove it, Rip Van Winkle is sleeping under a tree[end if]."
Before listing nondescript items of the Catskills:
if Rip Van Winkle is marked for listing:
now Rip Van Winkle is not marked for listing;
if Rip Van Winkle is not asleep,
say "Rip Van Winkle stands here, looking mightily confused."
Often it is best to have an entire paragraph about the characters present in a room, but suppose we're narrating a large party with a lot of people moving around. In that case, it might be better to list everyone together, then add a few salient details by way of follow-up, like this:
Before listing nondescript items:
say "You can see [a list of people who are marked for listing] here. ";
repeat with named party running through people:
now the named party is not marked for listing;
let count be the number of visible other people who are carrying something;
if count is 0:
say paragraph break;
continue the action;
let index be count;
repeat with holder running through visible other people who are carrying something:
if index is count, say "[The holder]";
otherwise say "[the holder]";
say " has [a list of things carried by the holder]";
make delimiter index of count.
The next part could be simpler, but for rigor we will write it in such a way that it will work whether or not the serial comma is in use. This requires some extra work.
To make delimiter (index - a number) of (count - a number), continuing or halting:
if index is 0:
if continuing, say ". [run paragraph on]";
otherwise say ".";
otherwise if index is 1:
if count is 2, say " and ";
otherwise say "[optional comma] and ";
say ", ".
And now the scene:
let wanderer be a random other person;
let place be the holder of the wanderer;
let next place be a random room adjacent to the place;
let the way be the best route from the place to the next place;
try the wanderer going the way.
The Kitchen is west of the Banquet Hall. "Dominated by a pile of dirty plates which you imagine it will be someone's privilege to wash, later." Vanessa is a woman in the Kitchen. Vanessa carries a tray. On the tray is a salmon roll. The roll is edible.
The Eye of the Idol
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:
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;
With that done, removing these items automatically from the room description is actually pretty easy:
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 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:
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'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]."