Daily Nugget # 3: Scheduling repeated events

Hi All,

In my WIP I wanted to add some scheduled events reminding the player they have been impacted by their actions in the past. A form of delayed gratification/punishment, and to rub it in, these events repeat…

So a data structure like a ring buffer seemed perfect. And lo and behold, chapter 21 on lists discusses this: 21.11. Variations: arrays, logs, queues, stacks, sets, sieves and rings (ganelson.github.io).

Here is a small test game. say something and the well captures it and plays it back. Anything new said will be added to the end of the ring, so the bigger the ring, the longer it will take before you hear the latest thing said again. Of course putting this in an actual game is not practical, people might say anything… I merely show the mechanics here.

The power of Inform really comes into play if you start including phrases which refer to ‘to say’ pieces of code so you can basically do anything… Lower player stats, or whatever…


@Draconis has a lot of useful snippets, such as this one that allows you to cancel an “in X turns from now” event.