Trigger event on the hour every hour

Hi,

I need to trigger an event on the hour every hour. I have tried :

‘At the time when the minutes part of the time of day is 0’ but inform doesn’t like it.

In the simple case when nothing will interfere with the steady plod of time forward by 1 minute per turn, you can just do this as a quick and dirty solution:

Every turn when the minutes part of the time of day is 0:
	say "Ding-dong! The time is [the time of day]";

To be more sophisticated, to ensure your event still fires if code in your game has caused time to skip forward past the exact hour (anything up to half an hour), you can do this:

The every turn rule here, for the purpose of demonstration, skips time forward by a total of 21 minutes (20 minutes in the rule plus the standard 1 minute advance) every turn. The chimes will go off as soon as time reaches or goes past the exact hour. ‘to the nearest 60 minutes’ ensures the next trigger for the chimes is set to the next hour exactly, regardless of the actual time the rule triggered.

One caveat, with this approach if time ever skips forward to more than half an hour after the chimes are due they will never trigger, so if you have code which does that it will need to reset the chimes when it does so.

Similarly, if code causes time to skip backwards to before the last o’clock, the chimes won’t trigger on the hour unless the next chimes are set back also.

"Chimes" by PB

The Waiting Room is  a room.

When play begins:
	chimes ring at 09:00 AM.
	
At the time when chimes ring:
	say "Ding-dong! The time is [the time of day]";
	chimes ring at 60 minutes after the time of day to the nearest 60 minutes;

Every turn when the turn count is not 1:
	now the time of day is 20 minutes after the time of day;
1 Like

Super helpful, thank you!