[Beta-ish Utility Release] Hook System - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: [Beta-ish Utility Release] Hook System (/showthread.php?tid=64162) [Beta-ish Utility Release] Hook System by Eljay on 07-28-2006 at 05:23 PM
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 ) code: 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) RE: [Beta-ish Utility Release] Hook System by Chestah on 07-29-2006 at 03:39 AM looks cool! i'll have a look at it tonight! thanks eljay RE: [Beta-ish Utility Release] Hook System by segosa on 07-29-2006 at 06:54 AM It's good, it works... I just can't see how it's useful? No, really, I'm trying to think of a single use for it and I can't think of any . I've never really needed to rename the existing functions. RE: RE: [Beta-ish Utility Release] Hook System by alexp2_ad on 07-29-2006 at 09:06 AM
quote:I can see that it makes it easy to add and remove functionality on the fly. Eg. instead of having a variable used in an if that sets whether a certain option is run, you can just add the functionality with the hook when the option is changed. Might make bug finding a little difficult though, since you might not be sure what order the functions are being called. RE: [Beta-ish Utility Release] Hook System by Eljay on 07-29-2006 at 09:11 AM
quote: well blah, give me an idea for something useful and ill (try to ) make it cos im bored out of my skull. RE: [Beta-ish Utility Release] Hook System by Keikonium on 07-29-2006 at 10:59 AM
Speaking of hooking messenger... RE: RE: RE: [Beta-ish Utility Release] Hook System by segosa on 07-29-2006 at 12:39 PM
quote: Good point, didn't think of that. |