Cycle timer

This is a timer that produces a rotating cycle of events, with a ten-second interval between event.

Events can be in the same room or in different rooms - these values are returned for a given timer stage by calling the event_list and cycle_location properties.

Code cycle_init: sched(10, cycle_setup, repeat=True) # Calls the cycle_timer to make an event every ten seconds.

Code cycle_setup: eventloc(locations.backstage, cycle_timer("The timer is running.")) # This is useful to know that your timer is still going, since its events may vary in location.

Code (args) cycle_timer:

args: message realm.cycle_stage = realm.cycle_stage + 1 if realm.cycle_stage > 5: # 'how many cycle stages.' Make sure to call the Realm property or you'll end up with local instances mucking everything up. realm.cycle_stage = 0 # Start over when you reach the end. sched(5, cycle_event(cycle_location(realm.cycle_stage), (random.choice(event_list(realm.cycle_stage))))) # Calls a random event from the event list for the given room. return message

Code (args) cycle_event:

args: loc, message eventloc(loc, message)

Code (args) cycle_location

args: stage if stage == 0: return locations.es_hall elif stage == 1: return locations.lounge ... etc, for all cycle stages.

Code (args) event_list

args: stage if stage == 0: return eh_list elif stage == 1: return lng_list ... etc, for all cycle stages.

Each event list is a Value field filled with strings, eg: ['A cold breeze passes by you.', 'Was that a footstep?'], etc.