I have been noting some demand for a fuller solution for real-time stuff in Inform 7 (the existing extensions Basic Real Time and Real-Time Delays are both stop-gaps, really). I created a pretty nice system of virtual timers into the old Glimmr animation extension, and thought that I’d port that over with some changes. I’m hoping to get a small community of folks interested in developing and maintaining it, since I probably won’t dedicate time to writing documentation, completing every corner of the implementation, or maintaining the extension in the future.
Before I release the first draft, I thought I’d check in to see whether there is a better way to do one of the more essential functions: callbacks, i.e. the function that gets called when the timer reaches 0.
Virtual timers are represented by a kind of value (“virtual timer”) and are intended to be essentially invisible to the author. Here’s how I want it to work: When you create a timer, the extension automatically selects a timer instance that isn’t running, sets up its properties, and ensures that it will fire at approximately the right time no matter how many other virtual timers might be running.
It’s essential that callbacks be both anonymous and flexible. What I have used in the past is a piece of text for the callback. The text could either be something that will simply be printed, or using the trick below, it could call essentially any phrase (though some punctuation is verboten).
To say @ (ph - phrase): (- if (0==0) {ph} -).
The idea is that for most authors, using the extension wouldn’t involve much more than this sort of thing:
every 250 seconds "[@ play sound of Theme B]"
after 5000 milliseconds "[@ play sound of creaking door]";
Authors who needed to could of course define custom phrases, or e.g. call rulebooks from the callback text element.
So, my question is: Is there any other method that might seem more natural and Inform-7y that would be equally as simple and powerful as this trick with text? (I haven’t looked much as 6L38’s features, so if there’s something new that fits the bill–great!)
Thanks!