| Chapter 5: Text |

| 5.5. Text with variations

Messages sometimes need to take different forms in different circumstances. For instance, suppose we have a cask which, being a container, is always either open or closed. Then setting this:

> The printed name of the cask is "[if open]broached, empty cask[otherwise]sealed wine-cask".

we find that the cask is described as "a broached, empty cask" when open, and "a sealed wine-cask" when closed. Any condition can follow an "if", and there will be much more about conditions later. Here is a more substantial example:

> The Customs Wharf is a room. "Amid the bustle of the quayside, [if the cask is open]many eyes stray to your broached cask. [otherwise]nobody takes much notice of a man heaving a cask about. [end if]Sleek gondolas jostle at the plank pier."

The text following "[otherwise]" is printed only if none of the previous "if" conditions have been satisfied. After the "[end if]", it is back to printing as normal: so the part about gondolas is printed in every eventuality. (As earlier examples show, "[otherwise]" and "[end if]" are optional. We could also specify alternatives by writing, say, "[otherwise if the cask is transparent]".)

We sometimes need to be careful about the printing of line breaks:

> The Cell is a room. "Ah, [if unvisited]the unknown cell. [otherwise]the usual cell."

This room description has two possible forms: "Ah, the unknown cell. ", at first sight, and then "Ah, the usual cell." subsequently. But the second form is rounded off with a line break because the last thing printed is a ".", whereas the first form isn't, because it ended with a space. The right thing would have been:

> The Cell is a room. "Ah, [if unvisited]the unknown cell.[otherwise]the usual cell."

allowing no space after "unknown cell."

52
| Example When? A door which says "...leads east" in one place and "...leads west" in the other.

Very simple, but quite frequently useful: "When?" The temporal vortex is an open door. It is west of Yesterday and east of Today. "A whirling temporal vortex leads [if in Yesterday]west[otherwise]east[end if]."

53
| Example Whence? A kind of door that always automatically describes the direction it opens and what lies on the far side (if that other room has been visited).

54
| Example INVENTORY listing with separate carried and worn items Separate the player's inventory listing into two parts, so that it says "you are carrying..." and then (if the player is wearing anything) "You are also wearing...".

Previous | Contents | Next