Just a small utility thing ive been thinking of making and finally got so bored i actually made it. (dempsey now owes me 2p cos he bet i wouldnt make it
)
Basically its a hook system (hence the extremely imaginative name). You create a function, then call Hook.add like so:
Hook.add(<event name here>, <function here (not in quotes!) >);
e.g.
code:
function blah(status){ Debug.Trace(status); }
Hook.add('OnEvent_MyStatusChange', blah);
now blah() is called with the first parameter of OnEvent_MyStatusChange as its first parameter (i.e. x = NewStatus). So the new status (number) is traced to the debug console. Neat huh?
You can also remove functions from their hooks using the very easy to remember Hook.remove (which takes the exact same parameters as Hook.add)
Finally, if you so desire, you can add your own event hooks by calling Hook.newhook('nameofyourhook') and then calling Hook.call('nameofyourhook', {parameter object}) whenever you want the hooked functions to be triggered.
See attachment for usage example and the utility itself (_hooksystem.js)