Is there a way to make scheduled actions trigger every day?

So, Inform has a really neat, included system of time, which works marvelously…the first time. If, for example, I set something up a variable to increment at 11:59, it increments whether the time ever actually “lands on” 11:59 or not. (That is, if I have an action that takes an “hour” to complete, and undertake it at 11:30, the day will still properly increment, even though the player never takes a turn on 11:59 precisely.). But this only works once. If the clock reaches 11:59 again, nothing happens. I’ve scripted a clumsy workaround (in case anyone finds this thread by googling):

[code]Days elapsed is a number that varies. Days elapsed is usually 0.
A weekday is a kind of value. The weekdays are Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday. The current weekday is a weekday that varies. The current weekday is Friday.

DayToggle is a number that varies. DayToggle is usually 0.

Every turn:
If the time of day is after 11:59 PM and DayToggle is 0:
now DayToggle is 1;
now Days Elapsed is Days Elapsed + 1;
now Current Weekday is the weekday after Current Weekday;
If the time of day is before 2:00 PM and DayToggle is 0:
now DayToggle is 1;
now Days Elapsed is Days Elapsed + 1;
now Current Weekday is the weekday after Current Weekday;
If the time of day is after 2:00 PM and the time of day is before 11:59 pm and DayToggle is 1:
now DayToggle is 0;

Hourtesting is an action out of world. Understand “HOURTEST” as Hourtesting.

Carry out Hourtesting:
Increase the time of day by 1 hour.

6Hourtesting is an action out of world. Understand “6HOURTEST” as 6Hourtesting.

Carry out 6Hourtesting:
Increase the time of day by 6 hours.
[/code]

But while this should work in my game, (I think) it’s very ugly relative to the elegant simplicity of “at 11:59, do X,” and it does have the potential to break, in theory, if the player were somehow to undertake an exceptionally long action. While I don’t intend to allow any such actions, it still feels like there must be something simpler and surer that I’m missing. Is there a way to make the native scheduling language work on all days, rather than just the first time the appointed hour arrives?

This is somewhat cleaner:

``````When play begins: the wombat expostulates at 9:15 am.
At the time when the wombat expostulates:
say "wombat!";
the wombat expostulates in 1411 minutes from now.``````

It doesn’t quite work how you want, since you lose half an hour each time. The timed events rule has a resolution of 30 minutes, so if you use a number closer to 1440 the event will happen again on the next turn. You could maybe fix that by waiting to schedule the event again until the next turn, or perhaps someone else can suggest a better way.

I used 9:15 am in the example above since the code actually doesn’t work for 11:59 pm if turns take longer than a minute, due to a bug in the timed events rule (I’ve just reported it) where the wrap-around of times at midnight isn’t handled properly. If you use a time where you can’t reach midnight in one turn, then it works.

Hm, unfortunately, since The action in question is advancing the calendar day, it really needs to be 11:59, and it needs to stay at 11:59 day after day. Than you, though!

All right, this works:

``` When play begins: the wombat expostulates at 12:00 am. At the time when the wombat expostulates: say "wombat!"; we need to enqueue the timed event in 30 minutes from now. At the time when we need to enqueue the timed event: the wombat expostulates at 12:00 am. ```I had to change the time to 12:00 am instead of 11:59 pm to avoid the bug I mentioned above, but hopefully this is close enough for your purposes? It is annoying that you need two different timed events and that it depends sensitively on the 30-minute resolution, but at least it’s relatively concise.

Thanks! That solved it!

Question - does Inform 7 consider “minutes” and “turns” as the same thing?

I might be wrong about this, but in my head I’m thinking if you set something to occur “ten minutes from now” and your turn length is three minutes per turn, that it would skip the event since the turn never lands on “ten minutes from” when you scheduled it.

I’ve always used “turns” because it would seem no matter what the time of day, giving the player a command prompt is a “turn” and it’s always going to count that, even if the event is scheduled and I hit an event that ratchets time ahead eight hours. Am I deluded or is that kind of how it works?

It depends how you’re changing the turn length.