![]() | Chapter 8: Change | ![]() ![]() |
8.1. Change of values that vary |
So far, what we have done in response to the player's commands amounts to little more than a few ripostes. The simulated world does change during play, as the player moves from room to room or picks up things, but all of this is happening automatically, not at our direct instruction. How then can we make the world change?
Recall that the world consists of rooms, in which are things, and that all of these have properties appropriate to their kinds. Some properties are either/or ("open" or "closed" but not both and not neither), while others have values (the "matching key" of a lockable door, for instance). Finally, we may also have created some free-standing values or "variables".
We take the last example first, as it is the simplest. Suppose we have:
"Winds of Change"
The prevailing wind is a direction that varies. The prevailing wind is northwest.
The Blasted Heath is a room. "Merely an arena for the play of witches and kings, my dear, where the [prevailing wind] wind blows."
Instead of waiting when the prevailing wind is northwest: say "A fresh gust of wind bowls you over."; change the prevailing wind to the east.
The new phrase here is "change". This automatically checks that the new value is one which makes sense in the given context, so for instance it would not allow either of these:
change the prevailing wind to 25; change the prevailing wind to the Heath;
the former being a number, and the latter a room, so that neither is a direction. Similarly, "change" will not allow values to be changed, only values which vary. So
Colour is a kind of value. The colours are blue, red and mauve. Instead of pulling the psychedelic lever, change blue to mauve.
...will result in a complaint like so:
Problem. You wrote 'change blue to mauve', but 'blue' is not something which can ever change.
Previous | Contents | Next |