What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Script Always Stopped

Script Always Stopped
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Script Always Stopped
Since this seems to be a frequently asked question, I'll spend some time explaining this a bit more in depth...

When working with objects, you have to understand the difference between classes (or instances) and singletons (static objects).
  • Class instances are objects which represent an instance of something to communicate with it through its properties and methods.

    The reason why you can't use ChatWnd.SendMessage directly is because SendMessage() needs to communicate with a certain window, but none was specified. You first need to retrieve an instance in some way before working with it. For example, you can get a ChatWnd instance by calling Messenger.OpenChat, but you can also get one by looping through the Messenger.CurrentChats collection or through the ChatWnd parameter of an event. Once you got an instance, you're ready to go.

    Examples: ChatWnd, PlusWnd, Contact, Emoticon, DataBloc,...

  • Singletons are objects that are global (accessible from everywhere in the script) and provide methods and properties without being assigned to one instance. There is only one instance of these objects and you can't create new instances of them.

    The Messenger object for example has a MyName property which always represents the current user's nickname. It doesn't need to know what instance to communicate with, since it's always the same: the name of the currently logged in user (unless the current user is not signed in, but then there's nothing to work with).

    Examples: Debug, Messenger, MsgPlus and Interop.
Hopefully that was helpful. :)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-03-2009 04:37 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Script Always Stopped - by Samo502 on 09-03-2009 at 03:34 PM
RE: Script Always Stopped - by matty on 09-03-2009 at 03:46 PM
RE: Script Always Stopped - by Samo502 on 09-03-2009 at 03:50 PM
RE: Script Always Stopped - by matty on 09-03-2009 at 04:03 PM
RE: RE: Script Always Stopped - by Samo502 on 09-03-2009 at 04:12 PM
RE: Script Always Stopped - by Matti on 09-03-2009 at 04:37 PM
RE: Script Always Stopped - by Samo502 on 09-03-2009 at 04:54 PM
RE: Script Always Stopped - by Matti on 09-03-2009 at 05:01 PM
RE: Script Always Stopped - by Samo502 on 09-03-2009 at 05:34 PM


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