Daily Events

After extensive searching, I’ve yet to find a way to do the thing that I want to do. In this case, I just want to schedule events that happen every day at the same time. Here is where I’m starting:

[managing time]
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. 
Carry out waiting more: 
	let the target time be the time of day plus the time understood; 
	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]."
Check waiting more: 
	if the time understood is greater than one hour: 
		instead say "You might want to try 'wait until XX:XX AM/PM' instead.".

Hanging around until is an action applying to one time. 
Understand "wait until [time]", "wait for [time]" as hanging around until. 
Check hanging around until: 
	if the time of day is the time understood, say "It's already [time understood]." instead; 
Carry out hanging around until: 
	while the time of day is not the time understood: 
		follow the turn sequence rules. 
Report hanging around until: 
	say "You do whatever it takes to help the time pass. It is now [time understood]." 

At 1:00 PM:
	say "TEST".
	
The test room is a room.

When play begins:
	now the right hand status line is "[time of day]";

My problem is that the “TEST” text is only ever printed once, no matter how many days you wait. Is there a way that I can have this event repeat daily? I’m looking for something fairly scalable.

Every turn when the time of day is 1:00 PM:

A bit less elegant but it should work if you’re following the turn sequence rules every time.

Will that test be tested every turn? Is that normal for a scheduled event? Let’s say I want to implement a few hundred of these. Is that going to cause delay in the parser?

Is there some way of having I7 treat things like a switch case in programming where it just looks it up and finds an action to perform, instead of checking every case?

If you have enough of these you could make a table to handle it, but the delay isn’t too significant compared to what I7 already does. How many timed events do you expect to have?

You can do switch cases in I7:

Every turn: if the time of day is: -- 9:00 AM: say "something happens here."; -- 9:01 AM: say "this is another thing."; -- 9:03 AM: say "here's something else!".

Whether this is more efficient than having separate Every Turn rules for each time of day, I don’t know.

In theory, switch cases are designed to lighten the load by doing a direct lookup on the outcome, instead of having to test the condition multiple times. I was not aware that Inform7 had switch cases. Were they added recently? This is very big news to me, and I’m very excited to be able to do switch cases.

In any case, either solution seems to work here. I’m probably going to go with switch cases.

I believe the switch-case syntax is effectively syntactic sugar for

if x is zero:
    do something;
else if x is one:
    do something;
else if x is two:

It’s only slightly more efficient. The big benefit is letting you tidy your code.

No, it was an early feature addition.