Hey All, I was talking to Ziechael about his plans for my DynamicLightRecorder yesterday, and he was vaguely hoping that he could have it triggered when he updated a token using TokenMod. Now obviously this won't work out of the box, because the API doesn't trigger change events, so I said I'd talk to Aaron about putting a listener framework onto TokenMod - I believe that he did something similar with GroupInitiative and TurnMarker, or maybe it was Mark. But then as I thought about it some more, it occurred to me that maybe we could do better: how about we create a centralised event manager for all scripts to use? Here's how it would work: Install the EM as the first script in the sandbox The EM provides wrapper methods for all the Roll20 methods that return objects i.e. Campaign(), getObj(), getAllObjs(), findObjs(), filterObjs() These wrappers return wrapped objects that delegate to the underlying objects. But when you call .set() it also fires an appropriate change event All scripts that want to participate just need to global replace the calls to the above methods with EM.method, and then register their change handlers to EM.registerListener(eventName, listener) To make life easier we can have a 'noSelf' parameter on the register method so that you don't get millions of change events for your own set calls If we wanted to be really radical, we could have the EM also register *all* the available listeners on Roll20, and then have scripts shift over to registering everything with the EM. This would allow the EM to do helpful things like evening out the currently rather inconsistent event firing in response to API actions (e.g. createObj fires token:change but not token:add, you could choose not to receive on:destroy for your own remove calls etc, perhaps we could even debounce the annoying add/change combo for things that get grid-snapped) What do you think? It's actually a pretty easy script to write, it's just a case of getting agreement that it's worth doing/using from the main script authors here, otherwise it'd be a waste of time... Cheers, Lucian