Chapter 3: Place
§3.1. Room Descriptions; §3.2. Map; §3.3. Position Within Rooms; §3.4. Continuous Spaces and The Outdoors; §3.5. Doors, Staircases, and Bridges; §3.6. Windows; §3.7. Lighting; §3.8. Sounds; §3.9. Passers-By, Weather and Astronomical Events
![]() | Contents of The Inform Recipe Book |
![]() | Chapter 2: Adaptive Prose |
![]() | Chapter 4: Time and Plot |
![]() | Indexes of the examples |
§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
now the printed name of the Church is "Lightning-Struck Ruin";
now the description of the Church is "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 story 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 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
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.";
now the watch is 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 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
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 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.
See Looking for ways to change the default length of room descriptions
![]() | Start of Chapter 3: Place |
![]() | Back to Chapter 2: Adaptive Prose: §2.3. Using the Player's Input |
![]() | Onward to §3.2. Map |
|
|
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:
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:
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:
and then write a rule that applies to multiple rooms at once, like:
Inform's usual rule-ranking also means that more-specific rules will override less-specific ones, so we could add
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.
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:
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:
Next, we need the standard examining rule to look at our printing-the-description activity:
Now we do the same thing to room descriptions.
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.
|
|
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:
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:
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:
and then write a rule that applies to multiple rooms at once, like:
Inform's usual rule-ranking also means that more-specific rules will override less-specific ones, so we could add
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.
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:
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:
Next, we need the standard examining rule to look at our printing-the-description activity:
Now we do the same thing to room descriptions.
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.
|
|
|
|
|
|
|