Shoutbox

Detect receiving sound on ChatWndReceiveMessage - 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: Detect receiving sound on ChatWndReceiveMessage (/showthread.php?tid=97877)

Detect receiving sound on ChatWndReceiveMessage by Alfredao on 06-26-2011 at 07:09 AM

Hello, I never did a script for MsgPlus.

I have a friend who always send-me a "Wooooow!" sound (/swoow), and when he sends I answer with an "af", but doens't matter.

What I'm trying to do is, when i receive a Wooow, automatically asnwer with an "af" or whatever.


This is the script I did.

js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
    if(Origin != Messenger.MyName)
    {
        if(Message.search(/Wooooow/) != -1)
        {
            ChatWnd.SendMessage("af");
        }
    }
}

If I receive a message with "Wooooow" I will answer with af automatically but it isn't working when i receive a /swoow.

Someone can help-me?

Thanks and sorry for bad english.
RE: Detect receiving sound on ChatWndReceiveMessage by Spunky on 06-26-2011 at 09:29 AM

Not to sure but is the Wooooow in a certain colour?

try:

js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
     if(Origin != Messenger.MyName)
     {
         if(MsgPlus.RemoveFormatCodes(Message.toLower().search(/wooooow/)) != -1)
         {
             ChatWnd.SendMessage("af");
         }
     }
}

That will remove the colour codes before doing the search. It'll also make it all lower case just incase the capitalization is different
RE: Detect receiving sound on ChatWndReceiveMessage by Alfredao on 06-26-2011 at 10:46 AM

Not working.

I tried this.

js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
    ChatWnd.SendMessage(MsgPlus.RemoveFormatCodes(Message));
}

Nothing happens when I send /swoow or another sound.
I think its because the sounds.
RE: RE: Detect receiving sound on ChatWndReceiveMessage by CookieRevised on 06-26-2011 at 01:34 PM

quote:
Originally posted by Alfredao
I tried this.
js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
    ChatWnd.SendMessage(MsgPlus.RemoveFormatCodes(Message));
}

Do not use such code. It will trigger an infinate loop if it wasn't for the build-in flood checker!

If you want to output the message to check it, you should use the debug window:
js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
    Debug.Trace(Message);
}

However, the sounds (both the build-in ones and custom sounds) will not trigger the ChatWndReceiveMessage event. In other words, you can not do want you want.
RE: Detect receiving sound on ChatWndReceiveMessage by Alfredao on 06-27-2011 at 02:46 AM

Alright, thanks.