Stopping a waiting action when an event occurs

Hello all.

I’ve been lurking a long time and am new to writing with Inform 7. Throughout the current project I’ve been working on I have found most of the solutions to situations I’ve had searching this forum. It has been great to resource but I have come across a situation I cannot resolve on my own through online searches.

I’m using the waiting more code out of the Inform 7 examples so that the player does not have to repeatedly wait one turn at a time if they don’t want to. I want them to wait as long as they want as long as it doesn’t pass a certain time of day (in this case 11:00 PM). This part of the code works fine. The thing I cannot figure out is how to stop the waiting if a scene or scheduled event should occur during their waiting.

For example, the time of day is 1:00 PM and the player chooses to wait 60 minutes. There is a scene that will begin at the location at 1:30 PM. How can I make it so the waiting more command stops at the 1:30 PM scene start time and does not just continue past it to 2:00 PM? The code as it stands will show the scene start but the player will continue to do nothing until the full duration of the 60 minute wait is over.

Here is the current code that I am using:

[code]Waiting more is an action applying to one number.

Understand “wait [a time period]” or “wait for [a time period]” or “wait for a/an [a time period]” or “wait a/an [a time period]” as waiting more.

Check waiting more:
let the projected time be the time of day plus the time understood;
if the projected time is greater than 10:59 PM:
say “You can’t wait that long.”;
stop the action;
otherwise:
continue the action.

Carry out waiting more:
let the target time be the time of day plus the time understood;
decrease the target time by one minute;
while the time of day is not the target time:
follow the turn sequence rules.

Report waiting more:
say “It is now [time of day + 1 minute].”[/code]

Hopefully, you guys can give me some insight as to how to make this happen.

~Nutso

The most straightforward solution would be to add relevant conditions to the while loop:

Carry out waiting more: let the target time be the time of day plus the time understood; decrease the target time by one minute; while the time of day is not the target time and the Cut Scene is not happening: follow the turn sequence rules.
If you have lots of things that might disturb a waiting player at different occasions of the game, I suppose it might be easier to let all these things set a common flag as needed and check that flag:
[rant][code]
The Place is a room.
The time of day is 1:00 PM.
When play begins: now the right hand status line is “[time of day]”.

Wait no more is a truth state that varies.
Wait no more is false.
Every turn: now wait no more is false.

The Cut Scene is a scene.
The Cut Scene begins when the time of day is 1:30 PM.
The Cut Scene ends when the time of day is 1:31 PM.
When the Cut Scene begins: now wait no more is true; say “Cut it right here!”.

The Hold Up is a scene.
The Hold Up begins when the time of day is 1:35 PM.
When the Hold Up begins: now wait no more is true; say “Hold it now!”
After reading a command during Hold Up: now wait no more is true.

Check waiting:
if wait no more is true:
say “No more idle whiling away of time–now is the time of action!”;
stop the action.

Waiting more is an action applying to one number.
Understand “wait [a time period]” or “wait for [a time period]” or “wait for a/an [a time period]” or “wait a/an [a time period]” as waiting more.

Check waiting more:
if wait no more is true:
say “No more idle whiling away of time–now is the time of action!”;
stop the action.

Check waiting more:
let the projected time be the time of day plus the time understood;
if the projected time is greater than 10:59 PM:
say “You can’t wait that long.”;
stop the action;
otherwise:
continue the action.

Carry out waiting more:
let the target time be the time of day plus the time understood;
decrease the target time by one minute;
while the time of day is not the target time and wait no more is false:
follow the turn sequence rules.

Report waiting more:
say “It is now [time of day + 1 minute].”
[/code][/rant]

Thank you Felix.

I attempted something like what you suggest but I did not understand Inform 7 enough to get it to work. Your sample code showed me what I was missing and gave me the final piece of the puzzle I needed to make it work exactly how I wanted it to.

Once again, thanks for the assistance.

~Nutso

1 Like