What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » new and need some help

new and need some help
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: new and need some help
Because the variable "name" does not exist. I think you mean

JScript code:
naam = Origin;

This'll do.
The sending part: "SendMessage" is not a global function like you are using it. It is a method: a function that belongs to some object. So instead, you need to use this:

JScript code:
var naam;

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
    if(Origin !== Messenger.MyName) { // Check if we did not send the message
        //SendMessage(Blablablabla);
         naam = Origin;
         ChatWnd.SendMessage("hallo, " + naam + "!");
    }
    return Message; // We don't want to do anything with the Message
}

Notice any coincidence like OnEvent_ChatWndReceiveMessage's first parameter and the name of the object that has the SendMessage(); method? These must be the same. The function OnEvent_ChatWndReceiveMessage(); takes four "things" called arguments. The first one is an object: the chat window. The second (Origin) is the screen name of the person that sent the message. Message is the fourth, containing the actual message and the last one, MessageKind, tells you what type of message you're dealing with (offline message, search, search result, normal message etc.; see scripting documentation). Note that you can do this as well:

JScript code:
function OnEvent_ChatWndReceiveMessage(a1,a2,a3,a4) /* function header */{
    [some code in the function body]
}

Plus! won't mind that the argument names have been changed. But once you change the argument names in the function header (see above), you need to change it in the function body as well, so:


JScript code:
function OnEvent_ChatWndReceiveMessage(a1 /* originally the ChatWnd argument */,a2 /* Idem, Origin */,a3 /* Idem Message */,a4 /* Idem MessageKind */) /* function header */{
    a1.SendMessage("Hello world!"); // works okay
    ChatWnd.SendMessage("Hello world!"); // An error will occur now, saying that ChatWnd is not defined
}

So if you wish to stick to "naam = name" thingy:

JScript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,name,Message,MessageKind) {
    [code here]
}

This post was edited on 12-21-2009 at 05:52 PM by SmokingCookie.
12-21-2009 05:49 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
new and need some help - by debeste95 on 12-21-2009 at 01:02 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 01:15 PM
RE: RE: new and need some help - by debeste95 on 12-21-2009 at 01:20 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 01:25 PM
RE: RE: new and need some help - by debeste95 on 12-21-2009 at 01:31 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 01:33 PM
RE: new and need some help - by debeste95 on 12-21-2009 at 01:37 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 01:41 PM
RE: new and need some help - by debeste95 on 12-21-2009 at 01:47 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 01:50 PM
RE: RE: new and need some help - by debeste95 on 12-21-2009 at 01:55 PM
RE: new and need some help - by matty on 12-21-2009 at 01:53 PM
RE: new and need some help - by debeste95 on 12-21-2009 at 04:09 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 05:49 PM
RE: RE: new and need some help - by debeste95 on 12-21-2009 at 05:55 PM
RE: new and need some help - by SmokingCookie on 12-21-2009 at 06:02 PM
RE: new and need some help - by debeste95 on 12-22-2009 at 09:40 AM
RE: new and need some help - by SmokingCookie on 12-22-2009 at 09:52 AM
RE: new and need some help - by debeste95 on 12-22-2009 at 09:55 AM
RE: new and need some help - by SmokingCookie on 12-22-2009 at 09:58 AM
RE: new and need some help - by debeste95 on 12-22-2009 at 12:46 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