§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.


arrow-up.pngStart of Chapter 5: Text
arrow-left.pngBack to §5.4. Text with numbers
arrow-right.pngOnward to §5.6. Text with variations

*ExampleControl Center
Objects which automatically include a description of their component parts whenever they are examined.

Sometimes we want to make a list of something too complicated to express in a say list... phrase. When this happens, we can instead mark all the items we want to mention as "marked for listing".

In this case, we have a lawn area made up of four rooms. We want each room to automatically describe the directions leading to the other parts of the lawn. To do this, we will first determine which directions are relevant and mark those for listing, then list them.

paste.png "Tiny Garden"

The Herb Garden is a room. "Along this side of the house run your great-aunt's herb beds."

A Grassy Room is a kind of room. The printed name of a Grassy Room is usually "Lawn". The description of a Grassy Room is "The grass underfoot is thick and green. The lawn extends to [grassy directions] from here."

The following phrase goes through all the directions in the compass and marks the ones that are interesting to us at the moment. We will learn more about "the room (some direction) from..." in Chapter 5, and repeating in Chapter 10.

To say grassy directions:
    repeat with that way running through directions:
        if the room that way from the location is a grassy room,
            now that way is marked for listing;
    say "[a list of directions which are marked for listing]";
    now every direction is not marked for listing.

Lawn1 is west of the Herb Garden. It contains a picnic table and a wicker basket. Lawn2 is south of Lawn1 and southeast of Lawn4. Lawn3 is southwest of Lawn1, west of Lawn2, and south of Lawn4. Lawn4 is west of Lawn1. Lawn4 contains a birdbath. The birdbath is fixed in place.

Lawn1, Lawn2, Lawn3, and Lawn4 are Grassy Rooms.

Test me with "w / s / w / n".

**ExampleTiny Garden
A lawn made up of several rooms, with part of the description written automatically.

Sometimes we want to make a list of something too complicated to express in a say list... phrase. When this happens, we can instead mark all the items we want to mention as "marked for listing".

In this case, we have a lawn area made up of four rooms. We want each room to automatically describe the directions leading to the other parts of the lawn. To do this, we will first determine which directions are relevant and mark those for listing, then list them.

paste.png "Tiny Garden"

The Herb Garden is a room. "Along this side of the house run your great-aunt's herb beds."

A Grassy Room is a kind of room. The printed name of a Grassy Room is usually "Lawn". The description of a Grassy Room is "The grass underfoot is thick and green. The lawn extends to [grassy directions] from here."

The following phrase goes through all the directions in the compass and marks the ones that are interesting to us at the moment. We will learn more about "the room (some direction) from..." in Chapter 5, and repeating in Chapter 10.

To say grassy directions:
    repeat with that way running through directions:
        if the room that way from the location is a grassy room,
            now that way is marked for listing;
    say "[a list of directions which are marked for listing]";
    now every direction is not marked for listing.

Lawn1 is west of the Herb Garden. It contains a picnic table and a wicker basket. Lawn2 is south of Lawn1 and southeast of Lawn4. Lawn3 is southwest of Lawn1, west of Lawn2, and south of Lawn4. Lawn4 is west of Lawn1. Lawn4 contains a birdbath. The birdbath is fixed in place.

Lawn1, Lawn2, Lawn3, and Lawn4 are Grassy Rooms.

Test me with "w / s / w / n".

Sometimes we want to make a list of something too complicated to express in a say list... phrase. When this happens, we can instead mark all the items we want to mention as "marked for listing".

In this case, we have a lawn area made up of four rooms. We want each room to automatically describe the directions leading to the other parts of the lawn. To do this, we will first determine which directions are relevant and mark those for listing, then list them.

paste.png "Tiny Garden"

The Herb Garden is a room. "Along this side of the house run your great-aunt's herb beds."

A Grassy Room is a kind of room. The printed name of a Grassy Room is usually "Lawn". The description of a Grassy Room is "The grass underfoot is thick and green. The lawn extends to [grassy directions] from here."

The following phrase goes through all the directions in the compass and marks the ones that are interesting to us at the moment. We will learn more about "the room (some direction) from..." in Chapter 5, and repeating in Chapter 10.

To say grassy directions:
    repeat with that way running through directions:
        if the room that way from the location is a grassy room,
            now that way is marked for listing;
    say "[a list of directions which are marked for listing]";
    now every direction is not marked for listing.

Lawn1 is west of the Herb Garden. It contains a picnic table and a wicker basket. Lawn2 is south of Lawn1 and southeast of Lawn4. Lawn3 is southwest of Lawn1, west of Lawn2, and south of Lawn4. Lawn4 is west of Lawn1. Lawn4 contains a birdbath. The birdbath is fixed in place.

Lawn1, Lawn2, Lawn3, and Lawn4 are Grassy Rooms.

Test me with "w / s / w / n".