I just finished writing a small behavior that triggers events when certain instance variable changes.
If there is someone interested in it I could upload it for public use.
So far it has the following functionality:
Enable/disable trigger events for specific/any variables
Add variable to watch list (with variable name)
Remove variable from watch list (with variable name)
Add all variables to watch list
Triggers events when:
A watched variable has changed (filters by variable name)
Any variable in the list has changed
Basically it handles two arrays, one with the variable names and another with the values (just as the instances do with their instance variables), on each tick, if it sees any change in a variable, it stores the latest value and triggers an event.
*Saves the hassle of duplicating instance variables to keep track of changes (value/oldValue)
*Easier to maintain
*Adds the possibility to add new trigger events to an object without writing new behaviors, just add an instance variable name with the name of the event and add 1 to that variable each time you want to trigger that event