Irregular Thunder

This is a script that displays a random message at irregular intervals, Age-wide. (It is a simplified version of the thunder and lightning in Laufensea Pod.

This requires four properties, all at the realm (Age-wide) level.

The idea is that when the instance awakens (when someone links in), a regular timer begins: it will call  every 20 seconds. (The sched call runs its first iteration after a 20-second delay. We also call  immediately, so that the calls happen at 0 seconds, 20 seconds, 40 second, etc.)

doesn't display anything itself. It fires another, non-repeating timer with a random delay from 1 to 15 seconds. This ensures that the thunder doesn't happen exactly every 20 seconds. The first noise (cued by the immediate  call) will be 0-15 seconds after link-in; the second will be 20-35; the third will be 40-55; etc.

Finally,  does the actual work. It chooses a random string (from a list in a property) and displays it realm-wide.

After you set this up, be sure to use the /bootinstance command to kick yourself out of the Age and put it to sleep. The  property will run the next time you link in. You'll also have to /bootinstance if you change the  or   properties (say, if you're changing the delay values). Once started, the properties run until the instance sleeps, and changing their code while they're running is not generally possible.



thundertimer sched(datetime.timedelta(seconds=20), thundertimer, repeat=True)



sched(datetime.timedelta(seconds=random.randrange(15)+1), thundertimer2)



eventloc(realm, random.choice(thunderlist))



['You hear a crash of thunder.', 'Thunder rumbles in the distance.', 'You hear thunder crashing.', 'The sky flickers with lightning, followed moments later by rolling thunder.', 'Lightning illuminates the sky.', 'A double crack of thunder startles you.', 'A crack of thunder startles you.', 'You hear thunder, very near.']