What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Beta-ish Utility Release] Hook System

[Beta-ish Utility Release] Hook System
Author: Message:
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. [Beta-ish Utility Release] Hook System
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 :cheesy:)

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)

.plsc File Attachment: Hook System.plsc (1.52 KB)
This file has been downloaded 246 time(s).
07-28-2006 05:23 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Beta-ish Utility Release] Hook System - by Eljay on 07-28-2006 at 05:23 PM
RE: [Beta-ish Utility Release] Hook System - by Chestah on 07-29-2006 at 03:39 AM
RE: [Beta-ish Utility Release] Hook System - by segosa on 07-29-2006 at 06:54 AM
RE: RE: [Beta-ish Utility Release] Hook System - by alexp2_ad on 07-29-2006 at 09:06 AM
RE: RE: RE: [Beta-ish Utility Release] Hook System - by segosa on 07-29-2006 at 12:39 PM
RE: [Beta-ish Utility Release] Hook System - by Eljay on 07-29-2006 at 09:11 AM
RE: [Beta-ish Utility Release] Hook System - by Keikonium on 07-29-2006 at 10:59 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On