Inform 7 Home Page / Documentation
§18.27. Choosing notable locale objects for something
1. When it happens. See "printing the locale description". This activity is expected to decide which items ought to be mentioned in a locale description for a given room, enterable container or enterable supporter, and to give each item a priority, which is a number ranging upwards from 1 (which is the top priority). The lower the priority number, the earlier the mention, or at least, the earlier the opportunity to be mentioned: it's up to other activities whether to give it a paragraph of its own or not. This activity only makes something a candidate, and decides what order the candidates will be tried in.
2. The default behaviour. By default, this activity contains only the "standard notable locale objects rule". This chooses exactly those items directly contained by the locale, assigning all of them priority 5. Note that this includes scenery, and other probably unwanted items - those will be excluded later.
3. Examples. (a) In the Misty Moorlands, only large items on the ground are visible through the mist:
A thing can be large or small. A thing is usually small. The stepladder is a large thing in the Misty Moorlands.
Rule for choosing notable locale objects for the Misty Moorlands:
repeat with item running through large things in the Misty Moorlands:
set the locale priority of the item to 5.
Report taking a small thing in the Misty Moorlands:
say "You grope blindly in the mist and pick up [the noun]." instead.
Note the special phrase
set the locale priority of the item to 5;
which should be used only in rules for locale activities. It makes the given item a candidate and sets its priority. (Setting the priority to 0 forces an item not to be a candidate, and can thus undo the effect of previous rules.)
It's best to avoid situations where an item has a locale priority which is higher than that of something it is on top of, or inside, since this can result in an oddly-worded description.
|Start of Chapter 18: Activities|
|Back to §18.26. Printing the locale description of something|
|Onward to §18.28. Printing a locale paragraph about|
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.
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;
To decide whether the light level is low:
if the light level is high, no;
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:
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".
In a work of interactive fiction that involves many new discoveries, we might want to change the way we narrate room descriptions and describe objects as the player learns new information.
One approach to this is to create a model of the facts we want the player to find out, and attach some narrative text to each. When a fact becomes relevant to the story, that narrative text is shown to the player. So:
First we create the concept of facts, and the idea that facts can make some things more important than others.
A fact is a kind of thing. A fact can be known or unknown. A fact can be ready to learn or hidden. A fact has some text called the narration.
Definition: a thing is narratively significant if it conveys an interesting fact.
Definition: a thing is narratively dull if it is not narratively significant.
Conveyance relates various things to various facts. The verb to convey means the conveyance relation.
Definition: a fact is interesting if it is unknown and it is ready to learn.
Now, we also need a way to tell Inform to introduce certain new facts when the right previous ones have been introduced. We'll create a "following" relation, according to which a new fact can be told to the player when the player has already learned all the facts it follows. This way, we can simulate the effect of putting together several pieces of evidence to come to a conclusion:
Following relates various facts to various facts. The verb to follow means the following relation.
To say (new fact - a fact):
say "[narration of the new fact]";
now the new fact is known;
repeat with possible outcome running through facts which follow the new fact:
if every fact which is followed by possible outcome is known:
now the possible outcome is ready to learn.
Next we need a way for the game to introduce these new facts. Let's say we want them to come up when the player examines something appropriate, or sees it in the room:
After examining something which conveys an interesting fact (called discovery):
say "[discovery][paragraph break]".
After choosing notable locale objects:
repeat through the Table of Locale Priorities:
if the notable-object entry is narratively significant:
set the locale priority of the notable-object entry to 1.
For writing a paragraph about a narratively significant thing (called item):
now the item is mentioned;
let chosen fact be a random interesting fact which is conveyed by the item;
say "[chosen fact][paragraph break]".
The "after choosing notable locale objects" line here handles things so that any interesting conclusions we want to draw are always given first, followed by the less interesting description.
And finally, we need to give the player a little evidence to piece together:
Frince is a man in the Casino. The description is "Frince is a friend of yours -- if you reckon friendship on the same terms that one reckons a cat as a pet. He spends time with you when he wants to, but if your wishes or convenience ever run counter to a whim of his, it's the whim that wins. Always. [paragraph break]He's also wearing a somewhat ludicrous shirt."
Frince wears a ludicrous shirt. The description of the ludicrous shirt is "Fine white fabric with satiny white pinstripes: it's that expensive, effeminate look that Frince is so fond of, and which -- combined with his name -- gives people completely the wrong idea about him."
Tim is a man in the Casino. The description is "You don't know Tim well. Kind of wall-flowerish. The only thing that seems to excite him is craps."
Penny is a woman in the Casino. The description is "Loud. Brash. Hot, probably, if you can look past the loud and brash."
Rule for writing a paragraph about a narratively dull person:
let is-are-n be "is";
if the number of unmentioned narratively dull people is not 1:
let is-are-n be "are";
say "[A list of unmentioned narratively dull people] [is-are-n] [one of]watching the croupier[or]following the spin of the roulette[or]chattering[at random][one of] breathlessly[or] impatiently[or][at random]."
Penny-annoying is a fact.
It is ready to learn.
The narration is "[if looking]Penny grimaces at you-- [end if]Penny is the same woman who stepped on your toe in the buffet line. The third time, she blurted, 'You have big shoes, don't you?'"
Penny conveys penny-annoying.
lipstick-smudges is a fact.
It is ready to learn.
The narration is "There are a couple of smudges of coral-colored lipstick on the collar."
The ludicrous shirt conveys lipstick-smudges.
penny-wears-coral is a fact.
It follows penny-annoying.
The narration is "[if looking]Penny catches your eye again. [end if]The bright coral lipstick was really not a wise choice."
Penny conveys penny-wears-coral.
Affair-with-penny is a fact.
It follows lipstick-smudges and penny-wears-coral.
The narration is "You avoid [if examining Frince]his[otherwise]Frince's[end if] eye. You need some time to adjust to the image of him making out with Penny in a storage closet before you can talk to him without appalled giggling."
Frince conveys affair-with-Penny.