What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Can someone add something to this code

Can someone add something to this code
Author: Message:
Barathrum
Junior Member
**

Avatar
.......................

Posts: 42
30 / Male / Flag
Joined: Nov 2009
O.P. Can someone add something to this code
Well I have this code here:

code:
// Create an object container to store the chat window object
var oChatWnds = {};

// Store the chat window object in our object container when it is opened
function OnEvent_ChatWndCreated(oChatWnd) {
    oChatWnds[oChatWnd.Handle] = {};
}

// Remove the variable from the object if the window is closed
function OnEvent_ChatWndDestroyed(oChatWnd) {
    delete oChatWnds[oChatWnd.Handle];
}

// If we send a message remove the chat window from the object container
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    delete oChatWnds[oChatWnd.Handle];
}

// If we receive a message and the chat window exists in the object container
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageKind) {
    if (typeof oChatWnds[oChatWnd.Handle] === 'object') {
        // Send the message
        oChatWnd.SendMessage('hai');
        // Remove the chat window from the object container
        delete oChatWnds[oChatWnd.Handle];
    }
}



And in the part where it answers with "hai" I'd like if someone can make it so that if the messege recieved is "Hello" then it will answer "Hello" , if it's "hai" then it will answer "hai" . But if it's none of these two then it should just answer "Yo"
Hope you know what i mean.

Thanks in advance
01-10-2010 11:28 AM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: Can someone add something to this code
Javascript code:
// If we receive a message and the chat window exists in the object container
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageKind) {
    if (typeof oChatWnds[oChatWnd.Handle] === 'object') {
        // check which message was received
        switch (sMessage.toLowerCase()) {
            case "hai":
                oChatWnd.SendMessage('Hai');
                break;
            case "hello":
                oChatWnd.SendMessage('Hello');
                break;
            default: // anything else
                oChatWnd.SendMessage('Yo');
                break;
        }
        // Remove the chat window from the object container
        delete oChatWnds[oChatWnd.Handle];
    }
}

Something like that?
01-10-2010 11:56 AM
Profile E-Mail PM Find Quote Report
Barathrum
Junior Member
**

Avatar
.......................

Posts: 42
30 / Male / Flag
Joined: Nov 2009
O.P. RE: Can someone add something to this code
Works perfectly, thank you.
01-10-2010 12:53 PM
Profile E-Mail 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