5.5. Text with lists

| Chapter 5: Text |

| 5.5. Text with lists

We often want running text to include lists of items.

say "[list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Example: "Mr Darcy glares proudly at you. He is wearing [list of things worn by Darcy] and carrying [list of things carried by Darcy]." And, if this were from a dramatisation of the novel by Miss Fielding rather than Miss Austen, we might find: Mr Darcy glares proudly at you. He is wearing a pair of Newcastle United boxer shorts and carrying a self-help book. If the description matches nothing - for instance, if Darcy has empty hands - then "nothing" is printed.

As with all lists in Inform, the serial comma is only used if the "Use serial comma." option is in force. So by default we would get "a fishing pole, a hook and a sinker", rather than "a fishing pole, a hook, and a sinker".

We then need variations to add indefinite or definite articles, and to capitalise the first item. For example,

> "Mr Darcy impatiently bundles [the list of things carried by Darcy] into your hands and stomps out of the room."

might result in

> Mr Darcy impatiently bundles the self-help book and the Christmas card into your hands and stomps out of the room.

say "[a list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its indefinite article. Example: a maritime bill of lading, some hemp rope and Falconer's Naval Dictionary

say "[A list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its indefinite article, and the first is capitalised, so that it can be used at the beginning of a sentence. Example: A maritime bill of lading, some hemp rope and Falconer's Naval Dictionary

say "[the list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its definite article. Example: the maritime bill of lading, the hemp rope and Falconer's Naval Dictionary

say "[The list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its definite article, and the first is capitalised, so that it can be used at the beginning of a sentence. Example: The maritime bill of lading, the hemp rope and Falconer's Naval Dictionary

So much for articles. A more insidious problem comes with something like this:

> "The places you can go are [list of rooms]."

The trouble is that the list may end up either singular or plural. We might be expecting something like:

> The places you can go are Old Bailey, Bridget's Flat and TV Centre.

But if there is only one room, then the result might be:

> The places you can go are Bridget's Flat.

which is wrong. We can get around this with careful wording and a slightly different substitution:

> "Nearby [is-are list of rooms]."

say "[is-are list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. The whole list starts with "is" (if there's one item or none) or "are" (more than one). Examples: is marlin-spike are maritime bill of lading, hemp rope and Falconer's Naval Dictionary

say "[is-are a list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its indefinite article, and the whole list starts with "is" (if there's one item or none) or "are" (more than one). Examples: is a marlin-spike are a maritime bill of lading, some hemp rope and Falconer's Naval Dictionary

say "[is-are the list of description of objects]"

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its definite article, and the whole list starts with "is" (if there's one item or none) or "are" (more than one). Examples: is the marlin-spike are the maritime bill of lading, the hemp rope and Falconer's Naval Dictionary

say "[a list of description of objects including contents]"

This text substitution produces a list, in sentence form, of everything matching the description, noting any contents in brackets. This is really intended only to be used by the Standard Rules.

| Previous builds allowed this: say "[contents of object]" or: say "[the contents of object]"
This text substitution produces a list in sentence form of what is inside the object according to the object tree. Example: "Mr Darcy impatiently bundles [the contents of Darcy] into your hands and stomps out of the room." This is now deprecated - it's much better to use "[list of things carried by Darcy]", which is explicit about the relationship (carrying).

61
| Example Control Center Objects which automatically include a description of their component parts whenever they are examined. |
RB

It is straightforward to make a rule that anything with parts must mention all those parts during an EXAMINE command: "Control Center" After examining a thing when something is part of the noun: say "[The noun] includes [a list of things which are part of the noun]." The Control Center is a room. "Here you are at the Control Center of the universe." The Universe Management Computer is a fixed in place thing in the Control Center. "The Universe Management Computer sits directly before you, unguarded." The description of the Universe Management Computer is "The computer is so large that you would be unable to operate it all from one position. Alas, it does not come with a manual." A chartreuse indicator light, an ennui meter, a golden knob settable to 15,000 positions, a toothpick dispenser, and a button labeled RESTART are part of the Universe Management Computer. The command chair is an enterable supporter in the Control Center. It is pushable between rooms. "Because the computer is too large for you to reach all of the front panel from a standing position, there is a command chair on casters which allows you to push back and forth." The description of the command chair is "Quite ordinary, really, but for the heady rush of power that comes of sitting in it.". Some casters are part of the command chair. Now whenever we look at any object with components, we will first see the description, then a list of parts which belong to it. The following refinement brings in elements of later chapters, but it may be worth noting: because we've written our rule as an "After examining...", anything that pre-empts the operation of the examine command will also prevent that rule from occurring. So for instance: A hair-thick needle is part of the ennui meter. Instead of examining the ennui meter: say "You can't be bothered." ...would not result in the needle being mentioned. Test me with "x chair / x computer / x ennui meter"

62
| Example Tiny Garden A lawn made up of several rooms, with part of the description written automatically. |
RB

Previous | Contents | Next