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 can use "[unless ...]" to mean the same thing as "[if ...]", except that the sense is reversed. For instance:

The Customs Hall is a room. "With infinite slowness, with ledgers and quill pens, the clerks ruin their eyesight.[unless the player is a woman] They barely even glance in your direction."

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


61
* Example  When?
A door whose description says "...leads east" in one place and "...leads west" in the other.

RB
62
*** Example  Persephone
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...".

RB
63
*** 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).

RB

It would be fairly tedious reading to have a large game full of doors that describe themselves this way. Nonetheless, if we insisted we could use our knowledge of the map as leverage to make every door in the game describe itself automatically:

"Whence?"

The temporal vortex is an open door. It is west of Yesterday and east of Today.

The initial appearance of a door is usually "Nearby [an item described] leads [if the other side of the item described is visited][way through the item described] to [the other side][otherwise][way through the item described][end if]."

To decide what direction is the way through (frame - a door):
    let far side be the other side of frame;
    let way be the best route from the location to the far side, using even locked doors;
    if way is a direction, decide on the way;
    decide on inside.

Test me with "w / e".

Yet a further variation on this, which can automatically understand "the east door" and "the west door" when appropriate, may be found in the example "Whither?".


PreviousContentsNext