§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
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
(A word of warning: there is one other context in which the story prints a room name — when restoring a save or undoing a move. To omit the room title here too, add
Next, the story 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 story 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
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
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
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 story 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
And we can suppress the "(open)" and "(on which is...)" sorts of tags with the "omit the contents in listing" phrase, as in
Finally, the looking command lists visible non-scenery items that sit on scenery supporters, as in
These paragraphs can be manipulated with the printing the locale description activity and the printing a locale paragraph about 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.
|
ExampleNight Sky
A room which changes its description depending on whether an object has been examined.
|
|
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.
|
ExampleInfiltration
A room whose description changes depending on the number of times the player has visited.
|
|
Suppose we have a location that makes the player uncomfortable, and we want its description to change slightly each time he goes there, to reflect his increasing unease. We also want the door to that room to show whether he is going there for the first time, or whether this is a repeat visit.
We start with an ordinary room:
"Infiltration"
The Wasteland is a room. "In its more distant reaches, the Wasteland has a kind of austere beauty, but here beside the Secure Zone it is the worst of all possible worlds. Barrels of toxins are stacked the regulation hundred and fifty feet out; more traditional garbage has simply been flung over the wall, and this category includes one or two corpses roughly and inadequately disguised by black plastic bags. The wall itself has become a canvas for outcasts and exiles, and is covered with obscene paintings, lewd remarks about the inhabitants of the Secure Zone, and a few maudlin epitaphs."
Now the door, which will change from saying "leads inside..." to "leads back inside..." when this becomes appropriate:
The portal is a door. It is inside from the Wasteland and outside from the Secure Zone. "[if the player is in the Wasteland]To the west, a[otherwise]A[end if] portal in the cinder-block and barbed wire wall leads[if the player is in the Wasteland and the Zone is visited] back[end if] [if the player is in the Wasteland]inside[otherwise]outside[end if]."
Here we haven't used any conditions that we didn't know about in previous sections: the portal line only reflects whether the Zone has been visited never or visited once. But the Secure Zone itself makes use of the number of times visited:
The Secure Zone has the description "[if the player is in the Zone for the second time]Re-entering the Zone has not made you any more comfortable inside. [end if]Despite your carefully-chosen outfit and the walk you have been practicing, you are sure those inside can tell you don't belong. Not that very many people are visible here[if the player is in the Zone for more than the second time] -- the place seems more desolate than ever[end if]."
Instead of going west in the Wasteland, try going inside. Instead of going east in the Secure Zone, try going outside.
And finally, to be sure that the player does see our fancy changing descriptions:
Use full-length room descriptions.
Test me with "look / open portal / w / look / e / look / w / e / w".
Notice that the description of the Secure Zone changes from visit to visit, but that looking repeatedly during a single visit changes nothing.
|
ExampleAnt-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.
|
|
Suppose we want to create an object -- or maybe even a series of objects -- that warp the player's perception of every room description and object around him.
We've already seen some ways to create variations in text. For instance, we could make a room description with if substitutions in it, like so:
The Kitchen is a room. "[if the player is wearing the sunglasses]Are ants coming out of the sink? No, probably no.[otherwise]A small kitchen tucked into a corner of the vacation house. There is storage space for five or six cups, a sink, a two-ring stove; nothing else to speak of.[end if]"
That works fine if we have one or two variations we want to add; it's not so good if we're going to have several items that work like the sunglasses, or if we want the sunglasses to override the description of every room in the house.
A slightly more flexible method is to use a substitution that calls out to a say phrase, like this:
The Kitchen is a room. "[kitchen-description]"
To say kitchen-description:
if the player is wearing the sunglasses:
say "Are ants coming out of the sink? No, probably no.";
otherwise:
say "A small kitchen tucked into a corner of the vacation house. There is storage space for five or six cups, a sink, a two-ring stove; nothing else to speak of."
But again this doesn't handle the case of overriding multiple rooms at once very well.
When we reach a point where we need a given piece of text to be very flexible depending on the world model, it's time to use an activity.
Activities offer several advantages. One, we can create an activity like this:
Printing the room-description of something is an activity.
and then write a rule that applies to multiple rooms at once, like:
Rule for printing the room-description of a room when the player wears the sunglasses:
say "The walls look like they're covered with ants. Just a coincidence, I'm sure."
Inform's usual rule-ranking also means that more-specific rules will override less-specific ones, so we could add
Rule for printing the room-description of the Kitchen when the player wears the sunglasses:
say "Are ants coming out of the sink? No, probably not."
and have that rule override the behavior of the activity just in the kitchen. Meanwhile, our base room descriptions remain straightforward and uncluttered by if-statements.
Several other examples will show how to hook activities into existing actions: Crusoe goes into detail about how how to make the descriptions of things more variable, and Aftershock demonstrates activities for describing the behavior of switchable devices.
Here, we preview all of those methods, just to get a sense of how they work and why they might be useful in controlling a game. Subsequent chapters go into more detail about the syntax of creating activities and the list of activities that are already defined by Inform.
"Ant-Sensitive Sunglasses"
Part 1 - Procedure
To add a new activity to an existing Inform rule, we need to do three things:
1) Define our new activity.
2) Give a basic rule that says what is supposed to happen when that activity occurs, as in "Rule for..."
3) Replace the existing rule in Inform's rulebooks with a new one that calls on our activity.
Here we do this with examining:
Section 1 - Item Description
Printing the description of something is an activity.
Now, by default, we want to print the description property; we just want the option to write some extra rules overriding that property. So we tell Inform that our most basic rule for printing the description of something is just to give that description text:
Rule for printing the description of something (called item):
if the description of the item is not "":
say "[description of item][paragraph break]";
otherwise:
say "You see nothing special about [the item].".
Next, we need the standard examining rule to look at our printing-the-description activity:
The activity-based examining rule is listed instead of the standard examining rule in the carry out examining rules.
This is the activity-based examining rule:
carry out the printing the description activity with the noun;
rule succeeds.
Now we do the same thing to room descriptions.
Section 2 - Room Description
Printing the room-description of something is an activity.
Rule for printing the room-description of a room (called item):
if the description of the item is not "":
say "[description of item][paragraph break]";
otherwise:
do nothing instead.
The activity-based room description body text rule is listed instead of the room description body text rule in the carry out looking rules.
Our replacement rule this time around is a little bit trickier just because the rule that we're replacing is a complicated one: describing a room already checks to see whether there's light to see by, whether the player has turned off room descriptions when he enters a room for the second time, and whether the player character is (say) inside a closed box he can't see out of.
But all of those details are re-copied from the standard rules, and the important thing is that, at the end, we again carry out our activity.
This is the activity-based room description body text rule:
if the visibility level count is 0:
if set to abbreviated room descriptions, continue the action;
if set to sometimes abbreviated room descriptions and
abbreviated form allowed is true and
darkness witnessed is true,
continue the action;
begin the printing the description of a dark room activity;
if handling the printing the description of a dark room activity,
say "It is pitch dark, and you can't see a thing.";
end the printing the description of a dark room activity;
otherwise if the visibility ceiling is the location:
if set to abbreviated room descriptions, continue the action;
if set to sometimes abbreviated room descriptions and abbreviated form
allowed is true and the location is visited, continue the action;
carry out the printing the room-description activity with the location.
Section 3 - Device Description
Showing action of something is an activity.
Rule for showing action of something (called item):
if the item is switched on, say "[The item] is switched on.";
otherwise say "[The item] is switched off."
The activity-based described devices rule is listed instead of the examine devices rule in the carry out examining rules.
This is the activity-based described devices rule:
if the noun is a device:
carry out the showing action activity with the noun;
now examine text printed is true.
Report switching on something:
say "You flip a switch. ";
carry out the showing action activity with the noun instead.
Part 2 - Scenario
The Kitchen is a room. "A small kitchen tucked into a corner of the vacation house. There is storage space for five or six cups, a sink, a two-ring stove; nothing else to speak of."
The microwave is a device in the Kitchen.
South of the Kitchen is the Living Area. The description of the Living area is "A whitewashed living/dining/reclining area in what used to be a shepherd's stone hut, but now costs vacationers 600 euros a week. It offers no mod cons, only a straight view of the Mediterranean and a wobbly writing table."
Rule for printing the room-description of a room when the player wears the sunglasses:
say "The walls look like they're covered with ants. Just a coincidence, I'm sure[antsy]."
Rule for printing the room-description of the Kitchen when the player wears the sunglasses:
say "Are ants coming out of the sink? No, probably not[antsy]."
Rule for printing the description of something (called the item) when the player wears the sunglasses:
say "[The item] [are] [one of]ant-colored[or]ant-legged[or]covered in ants[at random][antsy]."
Rule for showing action of the microwave:
say "The microwave hums meaningfully to itself."
Rule for showing action of the microwave when the player wears the sunglasses:
say "The microwave hums as though inhabited by a billion ants[antsy]."
The player carries sunglasses of freakiness and an apple. The apple is edible. The sunglasses are wearable.
ant-paranoia is a number that varies.
To say antsy:
increase ant-paranoia by 1;
Every turn:
if the ant-paranoia is greater than 3:
say "Augh! AUUUGH! GET THEM OFF--";
end the story saying "You have lost your mind."
Test me with "look / turn on microwave / turn off microwave / x apple / x sunglasses / s / wear sunglasses / look / x apple / n / turn on microwave".
|
ExampleRip 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.
|
|
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:
Here is a lovely, secluded fold in the mountains, far from civilization: as though to prove it, Rip Van Winkle is sleeping under a tree.
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
You can see Rip Van Winkle here.
to the end of our description.
Here is how:
"Rip Van Winkle"
A person can be asleep.
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]."
A tree is scenery in the Catskills.
Rip Van Winkle is a man in the Catskills. Rip Van Winkle is asleep.
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."
Instead of waiting:
say "Rip Van Winkle wakes up with a snort.";
now Rip Van Winkle is not asleep.
Test me with "look / z / look".
|
ExamplePriority Lab
A debugging rule useful for checking the priorities of objects about to be listed.
|
|
When it comes time to start manipulating the priorities of items, it is useful to be able to check the table for debugging purposes; the problem is that printing the names of the objects can itself affect the way the room description is generated, foiling our debugging efforts.
What follows is a rule to help with debugging safely, and a sample of how priorities work:
"Priority Lab"
Section 1 - Procedure
Before printing the locale description (this is the dump locale table rule):
say "Locale Priority list:";
repeat through Table of Locale Priorities:
let the flag be whether or not the notable-object entry is mentioned;
say "[line break] [notable-object entry]: [locale description priority entry]";
if the flag is false, now the notable-object entry is not mentioned;
say line break.
Now, let's look at some items put in a specific order. Things with low priority numbers list towards the beginning; things with high priority numbers list towards the end. (It helps to think of it as though we were making a numbered list of the paragraphs to appear in the description.) Anything numbered 0 doesn't appear at all, and the default priority of an object is 1.
A thing can be early-described, late-described, latest-described, never-described, sightline-described, or ordinarily-described. A thing is usually ordinarily-described.
After choosing notable locale objects (this is the apply early and late description rule):
repeat with item running through early-described things:
if there is a notable-object of item in the Table of Locale Priorities:
set the locale priority of the item to 1; [list before everything else -- this would work with any number lower than 5 and higher than 0]
repeat with item running through late-described things:
if there is a notable-object of item in the Table of Locale Priorities:
set the locale priority of the item to 10; [list after everything else -- this would work with any number larger than 5]
repeat with item running through never-described things:
set the locale priority of the item to 0; [don't list at all]
continue the activity.
An important cautionary note: priorities are only honored if the objects are going to get their own paragraphs (with "writing a paragraph about..." or because they have initial appearances). Priorities do not affect the order in which items appear in the final "You can see..." list, except that items with priority 0 or lower are omitted. (If we want to order the items in that list, we may want to resort to the Complex Listing extension by Emily Short.)
There are further refinements available to us: for instance, we could make some things that are only visible if the player is raised above ground level.
After choosing notable locale objects (this is the sightline-described things are visible from supporters rule):
if the player is not on a supporter:
repeat with item running through sightline-described things:
if there is a notable-object of item in the Table of Locale Priorities:
set the locale priority of the item to 0; [remove objects that can only be seen from higher objects.]
continue the activity.
It may also be useful to know about the "parameter-object", which refers to the thing whose contents we are currently describing: the standard rules consider how to describe the contents of the location and then also check the contents of any supporter or container the player may be inside, so in the first case "parameter-object" would be the location, and then in the second the supporter in question.
In practice this is rarely useful, but should we need to change priorities in the case of both player and object being inside a particular container, we might make use of it, for instance:
A thing can be tasteful or icky. A thing is usually tasteful.
After choosing notable locale objects (this is the icky things next to players rule):
if the player is on the parameter-object:
repeat with item running through icky things :
if there is a notable-object of item in the Table of Locale Priorities:
set the locale priority of the item to 10; [remove objects that can only be seen from higher objects.]
continue the activity.
The other thing to note is that by default that final collection of generic objects ("You can also see...") appears at the end, regardless of the priority of everything else. If we really wanted to, though, we could force something to appear even after that paragraph, by adding a new listing rule to the locale description rules:
After choosing notable locale objects (this is the latest-described items priority rule):
repeat with item running through latest-described things:
if the item is a notable-object listed in the Table of Locale Priorities:
now the item is mentioned;
now the item is marked for late listing.
The late listing rule is listed after the you-can-also-see rule in the for printing the locale description rules.
A thing can be marked for late listing. A thing is usually not marked for late listing.
This is the late listing rule:
if something is marked for late listing:
say "Oh! And also [a list of things which are marked for late listing].";
now everything is not marked for late listing;
continue the activity.
Section 2 - Scenario
The Priority Lab is a room. The early bird, the worm, the leaf, the unseen object, the pebble, the twig, and the late edition are things in the Priority Lab.
The early bird is early-described. The late edition is late-described. The unseen object is never-described.
The worm is icky.
The high window is in Priority Lab. It is sightline-described and fixed in place. The initial appearance of the high window is "There's a tiny high window up near the ceiling that you can't see unless you're on top of something."
In order for the priorities we just set to be interesting, let's give out some initial appearances and writing a paragraph rules:
The initial appearance of the worm is "A worm inches along the ground."
The initial appearance of the late edition is "Finally, the late edition lies at your feet."
Rule for writing a paragraph about the early bird when the early bird is in a room: say "The early bird always appears first, and here it is."
Rule for writing a paragraph about the leaf: say "Look, there's [a leaf][unless the leaf is in the location] on [the holder of the leaf][end if]!"
Rule for writing a paragraph about an icky thing (called icky item) which is on something which supports the player: say "Ew, [an icky item] is right next to you."
This procedure also means (as you can test by experiment) that after the late edition has been picked up and dropped again, it lists in no special order in the "you can see..." paragraph (since initial appearances only print when the object has not yet been moved).
The afterthought is a thing in the Priority Lab. It is latest-described.
The bar stool is an enterable supporter in Priority Lab.
Test me with "get leaf / drop leaf / look / x unseen object / get pebble / look / get twig / look / get afterthought / look / drop twig / look / get late edition / look / drop late edition / sit on bar stool / look / get all / put all on stool / look".
|
ExampleLow Light
An object that is only visible and manipulable when a bright light fixture is on.
|
|
Suppose we want a different treatment of lighting than the usual: the room isn't totally dark, but there's something we can't see unless we turn on a bright light.
"Low Light"
First we make our environment and its light:
The Workroom is a room. The desk is in the Workroom. The brilliant lamp is a device on the desk.
To decide whether the light level is high:
if the brilliant lamp is switched off, no;
if the player cannot see the brilliant lamp, no;
yes.
To decide whether the light level is low:
if the light level is high, no;
yes.
Now we make a shadow so that the player can only refer to it if the shadow is in inventory or the light is on:
The shadow is a privately-named thing on the desk.
Understand "barely-visible" or "barely visible" or "shadow" as the shadow when the light level is high. Understand "invisible" or "shadow" as the shadow when the player encloses the shadow.
And finally a couple of extra touches to make it clear why we're able to interact with the shadow when it's in inventory, even if the light is low:
Before printing the name of the shadow:
if the light level is high:
say "barely-visible ";
otherwise if the player encloses the shadow:
say "invisible (but tangible) "
After dropping the shadow when the light level is low:
say "You let it go and it fades into the ambient gloom."
To handle the appearance of the object, we want to set its locale priority to 0: that will prevent it being named in room descriptions.
After choosing notable locale objects:
unless the light level is high:
set locale priority of the shadow to 0.
Test me with "look / get shadow / turn on lamp / look / get shadow / i / turn off lamp / i / drop shadow / look / get shadow / turn on lamp / look".
A fairly common effect in interactive fiction is a room which is described differently on the first visit than on subsequent visits. We can produce this effect as follows:
"Slightly Wrong"
Awning is a room. "A tan awning is stretched on tent poles over the dig-site, providing a little shade to the workers here; you are at the bottom of a square twenty feet on a side, marked out with pegs and lines of string. Uncovered in the south face of this square is an awkward opening into the earth."
Slightly Wrong Chamber is south of the Awning. "[if unvisited]When you first step into the room, you are bothered by the sense that something is not quite right: perhaps the lighting, perhaps the angle of the walls. [end if]A mural on the far wall depicts a woman with a staff, tipped with a pine-cone. She appears to be watching you."
Test me with "look / s / look".
Note the "[if unvisited]..." in the description of the Slightly Wrong Chamber. A room is considered to be "unvisited" until after the player has seen its description for the first time.
The bracketed text creates a special rule for printing; we will learn more about these in the sections on text with variations and text with substitutions.
Some further fine print: we might write our condition as "if unvisited", "if the location is unvisited", or "if the Chamber is unvisited" -- all of these constructions would be acceptable, but in the absence of more specifics, the condition is understood to apply to the object whose description it is.
|
ExampleThe 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.
|
|
"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 means 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 means 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".
In a very dense environment, we might want to offer the player room descriptions in which only the currently-interesting items are mentioned, while other objects are suppressed even if they are present. In effect, this takes the idea of scenery and makes it more flexible: different things might become background objects or foreground objects at different times during play.
There are a wide range of possible reasons to do this -- to shift the narrative emphasis, to change the mood of the game by highlighting different parts of the environment, to show the game from the perspective of different viewpoint characters -- but in the following example, our goal is to show the player only the objects that are currently useful for puzzles.
To do this, we need some notion of what puzzles are currently available and unsolved, so we make an "unsolved" adjective; we also need to know which things solve the puzzle, so we create a "resolving" relation, to indicate which objects resolve which problems.
Given that information, we can create rules about which objects in the game world are currently interesting, which are currently dull, and describe accordingly:
"Copper River"
Use scoring.
Section 1 - Procedure
Resolving relates various things to various things. The verb to resolve means the resolving relation.
Definition: a thing is interesting if it is not dull.
Definition: a person is dull:
no.
Definition: a thing is dull:
if it is unsolved, no;
if it resolves an unsolved thing, no;
yes.
Definition: a supporter is dull:
if it is unsolved, no;
if it resolves an unsolved thing, no;
if it supports an interesting thing, no;
yes.
Definition: a container is dull:
if it is unsolved, no;
if it resolves an unsolved thing, no;
if it contains an interesting thing, no;
yes.
After choosing notable locale objects:
repeat with item running through unsolved things:
set the locale priority of the item to 1.
For printing a locale paragraph about a dull thing (called item):
now the item is mentioned.
Before printing a locale paragraph about a supporter (called item):
now every dull thing on the item is mentioned.
Before printing a locale paragraph about a container (called item):
now every dull thing on the item is mentioned.
Instead of searching a supporter:
if the noun supports something interesting:
say "[A list of interesting things on the noun] [are] on [the noun]";
if the noun supports something dull:
say " (alongside [a list of dull things on the noun])";
say ".";
otherwise if the noun supports something dull:
say "There's nothing very useful here, only [a list of dull things on the noun].";
otherwise:
say "[The noun] [are] completely bare."
Instead of searching a container:
if the noun contains something interesting:
say "[A list of interesting things in the noun] [are] in [the noun]";
if the noun contains something dull:
say " (alongside [a list of dull things in the noun])";
say ".";
otherwise if the noun contains something dull:
say "There's nothing very useful here, only [a list of dull things in the noun].";
otherwise:
say "[The noun] [are] completely empty."
Before listing contents when not taking inventory: group dull things together.
Rule for grouping together dull things: say "assorted dull items".
Section 2 - Scenario World and Objects
The Kitchen is a room. "Your Aunt Fiona's kitchen looks as though it has been at the eye of a glitter storm. Fine, sparkling grit dusts every surface. The appliances are slightly askew, too, as though they hadn't quite settled after a vigorous earthquake."
The shelf is a scenery supporter in the Kitchen. On the shelf is a can of beans, a can of potato leek soup, and a tin of deflating powder.
The cabinet is a scenery container in the Kitchen. In the cabinet is a book of matches, a bottle of descaling solution, a fish hook, and a rusty knife. It is openable and closed.
The counter is a scenery supporter in the Kitchen. On the counter is an espresso machine, a blender, and a mortar. The blender and the mortar are containers. In the mortar is a pestle. Understand "countertop" as the counter.
The stove is a scenery supporter in the Kitchen. The oven is part of the stove. The oven is a closed openable container.
The refrigerator is a fixed in place container in the Kitchen.
Understand "fridge" as the refrigerator.
The description is "The refrigerator is a dull blue-green, and has a puffy, marshmallow texture on the outside, which means that it's no good for sticking magnets to. Aunt Fiona has never been willing to explain where she got it." The refrigerator is openable and closed.
In the refrigerator are a bottle of ice wine, a bag of carrot sticks, and an egg.
Aunt Fiona is a woman in the Kitchen. Aunt Fiona can be inflated or deflated. Aunt Fiona is inflated. "[if Aunt Fiona is inflated]Aunt Fiona stands nearby. Or perhaps 'stands' is the wrong word: she has been sort of puffed up in her own skin like a balloon, and is now propped in a corner of the room with her head lolling back[otherwise]Aunt Fiona stands -- on her own two slender legs -- at the center of the room[end if]."
Every turn when Fiona is unsolved and Fiona can see the player:
if a random chance of 1 in 3 succeeds:
say "[one of]Aunt Fiona's eyes follow you, wide and desperate, but it doesn't look like she's able to do anything[or]Aunt Fiona is still looking reproachful[or]A faint gurgling comes from Aunt Fiona[or]Aunt Fiona makes a funny croak noise[or]Aunt Fiona is still having trouble speaking. Perhaps her throat is as swollen as the rest of her[or]Aunt Fiona twitches[stopping]."
There is a thing called a salmon. Understand "fish" as the salmon. The salmon can be scaly or prepared. The salmon is scaly. The description is "[if scaly]It looks delicious, but is still covered with scales[otherwise]The salmon has been scaled and is ready to eat[end if]."
Before printing the name of the salmon when the salmon is scaly:
say "very scaly ".
Section 3 - Scenario Puzzles
Definition: Aunt Fiona is unsolved if she is inflated.
Definition: the salmon is unsolved:
if the salmon is off-stage, no;
if the salmon is scaly, yes;
no.
The deflating powder resolves Aunt Fiona.
Instead of putting the deflating powder on Aunt Fiona:
try throwing the deflating powder at Aunt Fiona.
Instead of giving the deflating powder to Aunt Fiona:
try throwing the deflating powder at Aunt Fiona.
Instead of throwing the deflating powder at Aunt Fiona:
if Aunt Fiona is inflated:
say "You toss some of the powder in Aunt Fiona's direction, and with a sudden gaseous HUFF! she returns to her usual shape and size. [paragraph break]'Well!' she says, brushing herself off. 'That was bracing!' [paragraph break]You give her an embarrassed smile, to apologize for not curing her faster.";
now Aunt Fiona is deflated;
increase the score by 2;
otherwise:
say "[one of]You throw another hefty dose of the powder at your aunt. [paragraph break]'Thank you, child,' she says, sneezing. 'But I think you've done enough now.'[or]You throw another hefty dose of the powder at your aunt. [paragraph break]'You're too kind,' she wheezes, through a cloud of glittering dust.[or]You've probably done enough with the powder.[stopping]".
Every turn when Aunt Fiona is deflated and the salmon is off-stage:
move the salmon to the counter;
say "'At least they didn't get this,' she says, producing from somewhere on her person a fresh-caught salmon. An odd pattern around its eye sockets makes it looks comically as though it wears spectacles. 'It's the Salmon of Knowledge,' she explains casually. 'We just need to scale and cook it.'"
The bottle of descaling solution resolves the salmon.
Does the player mean putting the descaling solution on the fish hook: it is unlikely.
Does the player mean putting the descaling solution on the salmon: it is very likely.
Instead of putting the bottle of descaling solution on the salmon:
if the salmon is scaly:
now the salmon is prepared;
say "With just a single squirt of the descaling solution (which confusingly has a picture of bathroom tiles on the label), you remove the scales from the salmon, leaving its pink flesh ready for preparation.";
increase the score by 2;
otherwise:
say "'Don't do that,' Aunt Fiona warns you. 'Excessive applications could damage the flesh.'"
Test me with "look / get powder / drop powder / look / look in cabinet / get powder / put powder on fiona / look / open cabinet / look in cabinet / get solution / open fridge / put solution in fridge / look / get solution / put solution on salmon / look".