Shoutbox

[Request] Away Talker - 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: [Request] Away Talker (/showthread.php?tid=62692)

[Request] Away Talker by Paril on 07-06-2006 at 08:40 PM

Hey.. Me again.

Anyway, I'm trying to get this script to say "Hey" when someone says "Hi".. any ideaS? I tried this:


var IsItOn;
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{   
    if(sMessage == "*PtalkOn")
    {
        IsItOn = true;
        return "";
    }
    if(sMessage == "*PtalkOff")
    {
        IsItOn = false;
        return "";
    }
}
function OnEvent_ChatWndRecieveMessage(pChatWnd, Origin, sMessage, MessageKind)
{   
    MessageKind = 1;

    if (IsItOn)
    {
        if (sMessage == "Hi")
            SendMessage ("Hey!");
        return sMessage;
    }
    else
        return sMessage;
}




No dice.


-Paril


RE: [Request] Away Talker by J-Thread on 07-06-2006 at 09:13 PM

Try this script. There should be an english translation somewhere, but I can't find it.


RE: [Request] Away Talker by absorbation on 07-06-2006 at 09:15 PM

Easy peasy lemon squency:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
   return Message.replace("Hey", "HI");
}

RE: [Request] Away Talker by cloudhunter on 07-07-2006 at 01:20 AM

Here is working code :)

code:
var IsItOn = 0;

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if(Message.substr(0,8) == "*PtalkOn")
  {
    IsItOn = 1;
    return "";
  }
  if(Message.substr(0,9) == "*PtalkOff")
  {
    IsItOn = 0;
    return "";
  }
}

function OnEvent_ChatWndReceiveMessage(chatwnd, sOrigin, sMessage, nMessageKind)
{
if (sMessage.substr(0,2) == "Hi" || sMessage.substr(0,2) == "hi")
{
  if (IsItOn == 1)
  {
    pChatWnd.SendMessage("Hey!");
  } else {
    Debug.trace("IsItOns value is " + IsItOn + ", not 1, message not sent");
  }
} else {
  Debug.trace("Message is " + sMessage + ", not Hi or hi, nothing done.");
}
}


Let me know if it doesn't work.

Cloudy
RE: [Request] Away Talker by cooldude_i06 on 07-07-2006 at 01:25 AM

quote:
Originally posted by absorbation
Easy peasy lemon squency:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
   return Message.replace("Hey", "HI");
}


He was asking for sending a message when certain text was received, not replacing certain text in outgoing messages. :P
RE: [Request] Away Talker by Silentdragon on 07-07-2006 at 01:40 AM

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, sOrigin, sMessage, nMessageKind) {
if(sOrigin == Messenger.MyName) return sMessage;
if (sMessage.search(/^hi$/i)) {
  if (IsItOn)
    ChatWnd.SendMessage("Hey!");
}

Better function
RE: [Request] Away Talker by S4mP410 on 07-07-2006 at 02:31 AM

Doesn't work here :undecided: