Tailored Room Description by Emily Short


Tailored Room Description is an extension for use with Emily Short's Room Description Control. Tailored Room Descriptions provides a set of rules for writing paragraphs about objects.

Chapter: Using Tailored Room Description

Section: Overview of Tailored Room Description's Process

The behavior of Tailored Room Description is to go through the list of Seen Things prepared by Room Description Control and follow this protocol:

(a) if the item in question has an initial appearance and has not been moved, print the initial appearance; otherwise, if it has a flexible appearance (see below), print the flexible appearance; otherwise, say that you see the item.

(b) if the item is on or in something other than the location, mention the holder of the item and any other objects also in the holder of the item.

(c) if the paragraph so generated has mentioned any containers or supporters that themselves hold unmentioned items, generate sentences mentioning the contents of those things, until everything referenced by the paragraph has been adequately revealed.

(d) as an exceptional case, if the item is considered "deeply dull", a sentence will instead be printed listing the item together with all other "deeply dull" objects in a single sentence, as in "You also see here the wrench, the monkey, and the weasel." Items are only deeply dull if they share in having the lowest possible description-rank; according to the ranking rules of this extension, that means that they neither contain nor support anything, have no initial appearance, and have not been rendered interesting by any other ranking rule. It is possible to add further definitions to affect whether specific kinds of things are considered deeply dull; see the "Doors and doors" example below.

Section: Initial appearance, flexible appearance

Initial appearance is a description of something that is printed when the player looks and the object has not been moved. Tailored Room Description adds a "flexible appearance", which will be printed even if the object in question has been moved. So we might say

The initial appearance of the cup is "Someone has casually tossed away a paper cup here."

so that after being moved it will simply be described in the collection of random objects; but

The flexible appearance of the tripod is "A tripod is set up [if the location is indoors]on the floor[otherwise]on the ground[end if]."

so that the tripod will always have its own treatment, even if moved from room to room. If an item has both an initial appearance and a flexible appearance, the initial appearance will be consulted until the item is moved, and the flexible appearance afterward.

Section: Overriding the default for specific objects

The entire protocol can be overwritten by providing a more particular rule for writing a paragraph about for specific items; so for instance

Rule for writing a paragraph about a person (called dude):
     say "[The dude] is standing way too close to you."

would print this sentence and omit all other results.

The printing of an item's holder is managed by the disclosing exterior activity. We can change the way this is handled by writing a new rule for disclosing exterior of something. For instance:

Rule for disclosing exterior of tripod:
     say "[The tripod] is perched awkwardly on [the holder of the tripod]. "

Rules for disclosing exterior should ideally end with a period and a single space, in case the paragraph needs to continue thereafter.

The printing of an item's contents is managed by the disclosing contents activity. We can change the way this is handled by writing a new rule for disclosing contents of something. For instance:

Rule for disclosing contents of the vase when at least two things are in the vase:
     say "[The list of things which are in the vase] are crammed together into [if the vase is mentioned][the vase][otherwise][a vase][end if]. "

Again, this rule should produce output ending in a period and space, allowing for further sentences to follow without pause.

Tailored Room Descriptions also excludes from TAKE ALL any items currently being concealed by our concealment rules.

Chapter: Extra and Related Features

Section: Ordering the descriptions and excluding items

Users of Tailored Room Description sometimes ask how they can prevent something entirely from appearing in a room description. The answer is that this functionality -- choosing items that should not appear in the room description at all -- can be manipulated using TRD's base extension, Room Description Control. That extension's documentation explains how to write ranking rules and description-concealing rules for a variety of situations.

Section: Change Log

Version 3 of Tailored Room Descriptions builds on previous versions by adding description for things carried or held by non-player characters and better handling for enterable containers.

Version 7 of Tailored Room descriptions moves to a new way of managing internal text: rules to construct paragraphs, instead of constructing sentences out of small snippets of text intermingled with code, refer to tables such as

Table of Prementioned Containers
disclosure
"[The list of mentioned things which are in the current-subject] [mentioned-are] in [a current-subject][if current-subject contains something mentionable], which also [hold] [a list of mentionable things in the current-subject][end if]."

The disclosure entry here is a template used by the extension to create a viable sentence. One of these lines is selected at random from the table to use in each situation, which means that if we would like to diversify the range of sentence options, we can simply continue the table in our own code, as in

Table of Prementioned Containers (continued)
disclosure
"[The list of mentioned things which are in the current-subject] [mentioned-are] in [a current-subject], together with [a list of mentionable things in the current-subject][end if]."

We may also swap these tables entirely for other tables of our own devising, as in

When play begins:
     now the current-supporter-content-table is the Table of New Supporter Content.

The purpose of this change is to make the extension more flexible and more useful to authors working with alternative viewpoints (to recast the prose in first-person past tense, for instance) or in other languages. It also substantially reduces the number of individual rules and quantity of redundant code in the extension.

Version 8 tweaks the reporting of character possessions and worn items to appear more natural. It also adds section headings to the documentation.

Version 13/160601: Counterfeit Monkey version. Update for Inform 6M62. Fix tests. Remove dependency on Plurality.

Example: * Doors and doors - Writing paragraphs about doors to generate sentences such as "Exits include the white door and the black door. The black door is open."

"Doors and doors"

Include Tailored Room Description by Emily Short.

The Jurassic Room is a room. The white door is a door. It is north of Jurassic and south of Cretaceous.

The black door is a door. It is south of the Jurassic and north of the Triassic.

The purple door and the grey door are doors. The purple door is south of the Triassic and north of the Museum Forecourt. The grey door is southwest of the Triassic and northeast of the Parking Lot.

Definition: a door is deeply dull: no.

Rule for writing a paragraph about a door:
     let N be the number of mentionable doors;
     let O be the number of mentionable open doors;
     say "[if N is 1]The only door out is[otherwise]Exits include[end if] [the list of mentionable doors]. ";
     if N is O
     begin;
         say "[all O of them are]open.";
     otherwise if O is greater than 0;
         say "[The list of open doors referenced by the current-paragraph] [if O is 1]is[otherwise]are[end if] open.";
     otherwise;
         say "[all N of them are]closed.";
     end if.

To say all (N - a number) of them are:
     if N is 0
     begin;
         say "None are ";
     otherwise if N is 1;
         say "[one of]It's [or]It is [purely at random]";
     otherwise if N is 2;
         say "[one of]Both of them are [or]Both are [or]They are both [or]They're both [purely at random]";
     otherwise;
         say "[one of]They are all [or]They're all [or]Every one of them is [or]All [N in words] are [purely at random]";
     end if.

Test me with "open white door / look / open black door / look / n / close door / look / open door / s / s / open grey door / look / open purple door / look".

Example: * Boatman - A sample involving modified descriptions for items in an enterable container with the player.

"Boatman"

Include Tailored Room Description by Emily Short.

The Salt Lake is a room.

The rowboat is an enterable container in the Salt Lake. Understand "boat" as the rowboat. It contains a boatman, a pole, and a bottle of fresh water. The boatman is a man.

The Salt Lake contains a single flipper.

A ranking rule for the boatman: increase the description-rank of the boatman by 10.

Rule for writing a paragraph about the boatman when the boatman is in the rowboat:
     if entering the rowboat, say "[The boatman] leans to one side to provide balance as you scramble in. [paragraph break]";
     otherwise say "[The boatman] sits in [the rowboat], looking grim. [paragraph break]"

Rule for writing a paragraph about something while entering a container (called special-target):
     say "In [the special-target] with you, you see [the list of mentionable things in the special-target]."

Rule for writing a paragraph about a deeply dull thing which is in the rowboat when the player is in the rowboat:
     say "In the bottom of the boat, you see [a list of deeply dull mentionable things which are in the rowboat]. [paragraph break]".

Rule for writing a paragraph about a deeply dull thing which is in the Salt Lake:
     say "Floating on the impossibly buoyant water: [a list of deeply dull mentionable things which are in the Salt Lake]. [paragraph break]".

Test me with "get flipper / put flipper in rowboat / look / enter rowboat / get pole / look / get water / look / out / look / drop all / look / get in boat / look".

Example: ** Introductions - A system whereby both things and rooms can be given an "introduction", a tag line of text that is added the first time the player sees them in the room description if they are the main topic of a paragraph, or as an addendum to the object's description the first time it's examined. Introduction text can also be reviewed by the player with a THINK ABOUT command.

"Introductions"

Include Tailored Room Description by Emily Short.

Section 1 - The Rules

A thing has some text called the introduction. The introduction of a thing is usually "".
A room has some text called the introduction. The introduction of a room is usually "".

Rule for writing a paragraph about an as-yet-unknown introduceable thing (called special-target):
     carry out the writing a topic sentence about activity with the special-target;
     introduce the special-target;
     say paragraph break.

After examining an as-yet-unknown introduceable thing (called special-target):
     introduce the special-target;
     say paragraph break.

To introduce (special-target - an object):
     now the special-target is introduced;
     say "[introduction of the special-target]".

Definition: a thing is introduceable unless its introduction is "".
Definition: a room is introduceable unless its introduction is "".

A thing can be as-yet-unknown or introduced. A thing is usually as-yet-unknown.
A room can be as-yet-unknown or introduced. A room is usually as-yet-unknown.

The first time looking rule is listed after new object description rule in the carry out looking rules.

This is the first time looking rule:
     if location is introduceable and the location is as-yet-unknown
     begin;
         introduce the location;
         say paragraph break;
     end if.

A description-concealing rule:
     now every thing which is held by an as-yet-unknown introduceable person is not marked for listing.

Understand "think about [any introduceable introduced thing]" or "remember [any introduceable introduced thing]" as thinking about. Understand the commands "recall" or "consider" or "recollect" or "ponder" or "contemplate" as "remember".

Thinking about is an action applying to one visible thing.

Carry out thinking about:
     introduce the noun;
     say paragraph break.

Section 2 - The Scenario

The Maremma Breeding Ground is a room.

Logar is an animal in Maremma Breeding Ground. "Logar stands here, waiting for instructions."
     The description is "A nine-month puppy, Logar is nonetheless a pretty sizable dog already."
     The introduction is "He's your latest acquisition in a large collection of work dogs."

Logar carries a bone.
     The description of the bone is "Pretty well chewed already."
     The introduction of the bone is "That bone came out of a leg of lamb, but there's not much left on it."

Test me with "z / look / x logar / think about logar / x bone".

Example: ** Gobs of Mayonnaise - A scenario with various objects competing for our attention.

"Gobs of Mayonnaise"

Include Tailored Room Description by Emily Short.

The Farmhouse Kitchen is a room. "This place bears testament to its owners[apostrophe] patriotism, or possibly their devotion to Women's Day magazine. Pseudo-colonial decor abounds, including a multitude of tiny 13-star flags painted just under the ceiling. A heavy pedestal is located immediately opposite the door." The tiny 13-star flags are scenery in the Farmhouse Kitchen. "Stencilled all around the ceiling."

The chair is an enterable supporter in the Farmhouse Kitchen. It is pushable between rooms.

Jones is a man on the chair. Persuasion rule: persuasion succeeds.

A ranking rule for a person (called special-target):
     increase the description-rank of the special-target by 10.

A treasure is a kind of thing. A ranking rule for a treasure (called special-target): increase the description-rank of the special-target by 75.

The pedestal is a supporter in Farmhouse Kitchen. It is scenery. On the pedestal is a bust of Washington. The bust is a treasure. The flexible appearance of the bust is "A bust of Washington glares proudly over the room[if the holder of the bust is not a room] from [the holder of the bust][otherwise]... from about knee height[end if]. "

The table is in the Farmhouse Kitchen. "A rough-hewn table uses up an entire corner of the room."

A utensil is a kind of thing. A knife is a utensil. A fork is a utensil. The knife and the fork are on the table.

Before listing contents: initially group utensils together. Before grouping together utensils: say "a place setting (consisting of ". After grouping together utensils: say ")".

On the table is a vase. In the vase is a flower.

Rule for disclosing contents of the vase when at least two things are in the vase:
     if something in the vase is mentioned, say "Besides [the list of mentioned things in the vase] you can see in the vase [a list of mentionable things in the vase]. ";
     otherwise say "[The list of things which are in the vase] are crammed together into [if the vase is mentioned][the vase][otherwise][a vase][end if]. "

On the table is a glass. In the glass is a treasure called a diamond. The flexible appearance of the diamond is "A sparkling, winking diamond commands your attention!"

A description-concealing rule:
     if the diamond is in the glass, now the diamond is not marked for listing.

The Closet is west of the Farmhouse Kitchen. The Closet contains a plastic box. The plastic box is closed and openable and transparent. In it are a rubber chicken and a light bulb.

Before printing the name of an openable container (called special-target) while writing a paragraph about something:
     if special-target is open, say "open "; otherwise say "closed ".

The high shelf is a thing in the Closet. On the high shelf is a jug of mayonnaise. The flexible appearance of the jug is "The thing that draws your eye right off is an utterly enormous jug of mayonnaise."

A description-concealing rule when the player is not on the chair:
     now every thing enclosed by the high shelf is not marked for listing.

A ranking rule for the jug:
     increase description-rank of the jug by 100.