Right time. Right place.

Right, I’m having Problems Testing multiple conditions to bring about end of the game in Inform7.
I’ve reduced the game to Two rooms, for demonstration purposes.

1/ PHONE BOOTH
2/ STREET

The Aim of the game is simple. A taxi is going to pick you up from the STREET location after you call it.
A/ Call taxi from PHONE BOOTH.
B/ Go to STREET.
C/ Wait FIVE turns (or minutes)
D/ Get picked up by Taxi
E/ Game ends

If your not in the street at the right time you miss the taxi and have to call again. (The taxi doesn’t wait you if your not there)

So, to end the game I need to test two conditions:
That the players location is at “STREET”
AND
That so many turns (time) have elapsed since phone call. e.g right place right time.

If the player calls but is not at the “STREET” when the timer runs down then it says something like “you missed your taxi.” and the game just continues.

With more than one condition I just can’t seem to get the syntax right.

I’d be grateful if anyone could point me in the right direction.

//////////
Code:
"Taxi" by lampgetter.

When play begins:
now the right hand status line is “[time of day]”.

Phone booth is a room.
Street is a room.

[obviously there are lots more rooms in my game, but this makes it easier to show the problem]

Street is west of phone booth.

Taxi is a backdrop. Taxi is everywhere.
[this seems weird but it seems to work, because I’m verb-ing an abstract idea “the taxi”]

Phoning is an action applying to one visible thing.
Understand “Phone [something]” as Phoning.

Check phoning when the location of the player is not Phone booth: instead say “you need to be at the Phone Booth to call the taxi!”.

Carry out phoning:
Say “the taxi will arrive in 5 minutes at [5 minutes after time of day]”;

(? What next)
:smiley:

[code]Carry out phoning:
Say “the taxi will arrive in 5 minutes at [5 minutes after time of day]”;
the taxi arrives in 5 turns from now.

At the time when the taxi arrives:
if the player is in the Street:
say “The taxi pulls up right on time. You get in and instruct the driver to take you to the Latverian consulate by the quickest route possible.”;
end the story saying “Your adventures have only just begun”;
otherwise:
say “From the phone booth, you see your taxi pull up. After a minute or two, it drives away without you.”[/code]

Yep, That Works.
Thanks.

More details about setting up scheduled events with the “[event happens] in [x] turns from now” syntax can be found in §9.11 of the documentation.

Hmm… Hadn’t spotted that one. I’d been setting up my own timers and running them through Every Turn. Is there also a mechanism for cancelling that kind of timer if there’s no longer a need for it, or, indeed, altering the number of turns remaining on the fly? I didn’t see any in 9.11 of the documentation. I can do these types of changes in my own timers.

No, you can’t cancel or adjust a timer set that way. Use your own if you need that flexibility.

Thanks, zarf, I’ll bear in mind the “in X turns from now” construct for unchangeable timers! I guess they’ll be more efficient than my own. I’m just about to program a cancellable timer for my current game. I set a timer going, but if the player carries out one of a set of actions, it’s cancelled, and the expected event doesn’t happen on that occasion.

Curiosity prompts me speculate whether repeating the taxi arrives in X turns from now. later in the game with a different value for X would supersede the original X or set up an additional timer, or just cause an error. I may try that tomorrow…

It resets the original timer. If you phone the taxi, wait 2 turns, then phone the taxi again, the taxi will arrive only once, 5 turns after the second time you called.

One way you can get this effect is to set up a condition and then have the scheduled event check that condition when it goes off.

[code]The bomb can be armed or disarmed.

At the time when the bomb explodes:
if the bomb is armed, say “BOOM!”[/code]

If the player disarms the bomb, it doesn’t stop the timer per se, but when the timer runs down nothing happens, so it’s completely invisible to the player.

In which case, the objective of changing the timer can be achieved by resetting it. As for cancellation, yes, allowing it to trigger the event and cancelling it there would work.

And, indeed, if you set the taxi arrives in -1 turns from now., it never triggers, though it may waste a beat or so, checking at every turn.