Inform 7 Home Page / Documentation
§9.14. How many times?
There are two further ways to examine the historical record. Given any condition, we can say
if (...condition...) for the second time ...
if (...condition...) twice ...
if (...condition...) 2 times...
if (...condition...) two times...
(all of which are synonymous: the words once, twice, thrice, one, two, three, four, five, six, seven, eight, nine, ten, first, second, third, fourth, fifth, sixth, seventh, eighth, ninth and tenth all mean what they obviously should). The result is true if the condition holds now and has held for only one previous spell in the past. A condition holding for, say, fifteen consecutive turns without a break counts as only one "time" - so what we mean by "twice" here is that it is true now, was previously false for a while, and was previously true for a while before that, but no more. In effect, then,
if the player is in the Ballroom for the third time ...
is true if this is the third visit to the Ballroom. We can also say
if the player is in the Ballroom for more than the third time ...
or similarly "less than", "at least", "at most". It would be more natural, though, to say
if the player has been in the Ballroom three times ...
The adjective "only" (or equivalently "exactly") can be added to obtain
if the player has been in the Ballroom only three times ...
To recap, this means there have been exactly three visits to the Ballroom in history, whereas
if the player is in the Ballroom for the third time ...
means there have been exactly three visits, the third of which is still going on - an important distinction.
|
ExampleInfiltration
A room whose description changes depending on the number of times the player has visited.
|
|
Suppose we have a location that makes the player uncomfortable, and we want its description to change slightly each time he goes there, to reflect his increasing unease. We also want the door to that room to show whether he is going there for the first time, or whether this is a repeat visit.
We start with an ordinary room:
"Infiltration"
The Wasteland is a room. "In its more distant reaches, the Wasteland has a kind of austere beauty, but here beside the Secure Zone it is the worst of all possible worlds. Barrels of toxins are stacked the regulation hundred and fifty feet out; more traditional garbage has simply been flung over the wall, and this category includes one or two corpses roughly and inadequately disguised by black plastic bags. The wall itself has become a canvas for outcasts and exiles, and is covered with obscene paintings, lewd remarks about the inhabitants of the Secure Zone, and a few maudlin epitaphs."
Now the door, which will change from saying "leads inside..." to "leads back inside..." when this becomes appropriate:
The portal is a door. It is inside from the Wasteland and outside from the Secure Zone. "[if the player is in the Wasteland]To the west, a[otherwise]A[end if] portal in the cinder-block and barbed wire wall leads[if the player is in the Wasteland and the Zone is visited] back[end if] [if the player is in the Wasteland]inside[otherwise]outside[end if]."
Here we haven't used any conditions that we didn't know about in previous sections: the portal line only reflects whether the Zone has been visited never or visited once. But the Secure Zone itself makes use of the number of times visited:
The Secure Zone has the description "[if the player is in the Zone for the second time]Re-entering the Zone has not made you any more comfortable inside. [end if]Despite your carefully-chosen outfit and the walk you have been practicing, you are sure those inside can tell you don't belong. Not that very many people are visible here[if the player is in the Zone for more than the second time] -- the place seems more desolate than ever[end if]."
Instead of going west in the Wasteland, try going inside. Instead of going east in the Secure Zone, try going outside.
And finally, to be sure that the player does see our fancy changing descriptions:
Use full-length room descriptions.
Test me with "look / open portal / w / look / e / look / w / e / w".
Notice that the description of the Secure Zone changes from visit to visit, but that looking repeatedly during a single visit changes nothing.