Shoutbox

Reply to any message - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Reply to any message (/showthread.php?tid=93109)

Reply to any message by SourSpud on 12-03-2009 at 05:59 AM

I would like to reply to any message sent, for instance someone opens a conversation with me and types 'hey, staturday was fun.' I will reply with 'hai' but as soon as ive replied with hai i don't want to reply with 'hai' again after the next message is received so it doesn't loop.

thanks alot


RE: Reply to any message by matty on 12-03-2009 at 12:47 PM

You can't really detect who sent the first message.

Well I guess you could compare the Handle from the ChatWnd parameter in OnEvent_ChatWndCreated to the Handle of the ChatWnd parameter in OnEvent_ChatWndReceiveMessage that could work.


RE: Reply to any message by Spunky on 12-03-2009 at 12:51 PM

quote:
Originally posted by matty
You can't really detect who sent the first message.

Although if you script it right, it'll send "Hai" before your first message to them anyway. So you'll always say "hai" then your message, or the send something and then you send "hai" after it.
RE: Reply to any message by matty on 12-03-2009 at 02:09 PM

The problem is he wants it to reply to the first message they send ONLY if the window wasn't open before.

js 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];
    }
}

Untested code but give it a shot.
RE: Reply to any message by SourSpud on 12-03-2009 at 07:31 PM

tested seems to be working well thanks alot matty. Should have mentioned this earlyer, can it do a ranomise message say hi, hai, hello, hey. it will pick one of those.

Cheers


RE: Reply to any message by Spunky on 12-03-2009 at 08:36 PM

Add this to the start of the script

js code:
var messages = new Array("Hi", "Hai", "Hello", "Hey");

and change this line:

js code:
oChatWnd.SendMessage('hai');

to this:

js code:
oChatWnd.SendMessage(messages[Math.floor(Math.random()*(messages.length+1)])


Haven't tested, but that should work
RE: Reply to any message by SourSpud on 12-03-2009 at 09:05 PM

thanks for reply, i'm gettin this error

jscript code:
oChatWnd.SendMessage(message[Math.floor(Math.random()*(messages.length+1)])

quote:
Error: Expected ')' (code: -2146827282)

RE: Reply to any message by Mnjul on 12-03-2009 at 09:26 PM

Change

jscript code:
oChatWnd.SendMessage(message[Math.floor(Math.random()*(messages.length+1)])
to
jscript code:
oChatWnd.SendMessage(message[Math.floor(Math.random()*(messages.length+1))])
(note the extra right paren)
RE: Reply to any message by SourSpud on 12-03-2009 at 09:33 PM

thanks it works now :) my messages are in colour though. for example [c=49]Hai[/c] is there a way of the script checking if the person has Plus! installed before sending the message, and if its not installed don't send it.


RE: Reply to any message by Spunky on 12-03-2009 at 09:36 PM

Not really. The only way you can tell is by sending /ping... If you get a response they definitely have MP!L. If not they either don't have it, or have disabled the ping response.

It's too much hassle just to add to this, but you could add a "safe senders list" by manually adding contact's email addresses that can receive colours, but as I said, you'd have to ping each one...


RE: Reply to any message by SourSpud on 12-03-2009 at 09:42 PM

Thanks for the replys guys, yeah that would get abit annoying me sending a ping request to them all the time.

One last question the MsgPlus.DisplayToast is there a way to make it look like windows live messenger toast instead? if not is there a way of making an image popup in the same location for around the same ammount of time then disapear like a toast.


RE: Reply to any message by matty on 12-03-2009 at 10:06 PM

quote:
Originally posted by SourSpud
Thanks for the replys guys, yeah that would get abit annoying me sending a ping request to them all the time.

One last question the MsgPlus.DisplayToast is there a way to make it look like windows live messenger toast instead? if not is there a way of making an image popup in the same location for around the same ammount of time then disapear like a toast.
DisplayToast cannot be made to look like the WLM toasts. And to make your own is not so easy said as done.