Chapter 5: Text
5.4. Text with lists

The useful substitution "[list of description]" prints out, as an English sentence, a list of all the objects which match the given description. For instance,

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

Any description can be given and, as we shall see, descriptions can be very flexible indeed:

"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. A more insidious problem is that the list may end up either singular or plural. We might be expecting that the example above will produce 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 would 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:

"Near here [is-are list of rooms]."

which uses "is" or "are" as appropriate. Lastly, we can also make the items listed take the definite article by writing:

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

which might result in

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


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

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

RB

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.

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


PreviousContentsNext