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 245 time(s).
07-28-2006 05:23 PM
Profile PM Find Quote Report
Chestah
Veteran Member
*****

Avatar

Posts: 1658
Reputation: 34
36 / Male / –
Joined: Jun 2004
RE: [Beta-ish Utility Release] Hook System
looks cool! i'll have a look at it tonight! thanks eljay ;)
Segosa is newb.
07-29-2006 03:39 AM
Profile E-Mail PM Web Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: [Beta-ish Utility Release] Hook System
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 :p. I've never really needed to rename the existing functions.
The previous sentence is false. The following sentence is true.
07-29-2006 06:54 AM
Profile PM Find Quote Report
alexp2_ad
Scripting Contest Winner
****

Avatar
Who love the chocolate?

Posts: 691
Reputation: 26
37 / Male / –
Joined: May 2004
Status: Away
RE: RE: [Beta-ish Utility Release] Hook System
quote:
Originally posted by segosa
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 :p. I've never really needed to rename the existing functions.

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.  *-)
07-29-2006 09:06 AM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. RE: [Beta-ish Utility Release] Hook System
quote:
Originally posted by segosa
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 :p. I've never really needed to rename the existing functions.

well blah, give me an idea for something useful and ill (try to :P) make it cos im bored out of my skull.
07-29-2006 09:11 AM
Profile PM Find Quote Report
Keikonium
Full Member
***


Posts: 229
Reputation: 3
35 / Male / Flag
Joined: Jul 2006
RE: [Beta-ish Utility Release] Hook System
Speaking of hooking messenger...

Would it be possible thru a script and external .dll's to create something that would allow us to add icons to the dashboard in the main window? I'm thinking a browse button for .exe files that would grab the program icon, and display it in the dashboard. Then upon clicking the icon would launch the program. Or better yet defining a picture on the harddrive to display as the icon.

I know Plus! and Stuffplug and some tweaks with mess patch can add dashboard icons, so I don't *think* it is impossible. I've read that a script can do most of what .exe's can do, and since Plus! can add a dashboard icon, it shouldn't be out of the league of a script should it? I'm just talking off the top of my head here, but its something I have always wanted :D.
Now Playing:
[image not working] [Image: 87cc21b0.png]
07-29-2006 10:59 AM
Profile E-Mail PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: RE: RE: [Beta-ish Utility Release] Hook System
quote:
Originally posted by alexp2_ad
quote:
Originally posted by segosa
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 :p. I've never really needed to rename the existing functions.

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.  *-)


Good point, didn't think of that.
The previous sentence is false. The following sentence is true.
07-29-2006 12:39 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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