Shoutbox

send a basic 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: send a basic message (/showthread.php?tid=64246)

send a basic message by t0mmy9 on 07-30-2006 at 06:31 PM

hi, ive made half a script and need some help.
ive made the script say something to any user who types "hello" but i want it to type something else, lets say "busy" to any other contacts i am talking to once hello is typed by one of them. I know this is a basic language so this might not be possible but any help is appreciated. thanks.


i assume this is hard to do as i havent had a reply in a while
RE: send a basic message by Ezra on 07-30-2006 at 09:00 PM

I don't really understand what your trying to do?

When someone says hello, you want the script to say hello back to that user and say busy in all the other open convo's?


RE: send a basic message by Squelettor on 07-30-2006 at 09:02 PM

I don't have understand what do you want..make a example


RE: send a basic message by t0mmy9 on 07-30-2006 at 10:48 PM

"When someone says hello, you want the script to say hello back to that user and say busy in all the other open convo's?"

yes thats it, sorry i didn't explain it that well. say i have 3 windows open and this script busy. person1 person2 person3.
person1 types hello, the bot replys with hi, this i can do but then tells person 2 and person 3 im busy. understand me?

upon looking at all the commands available im not too sure if this is possible. ill still keep looking


RE: send a basic message by Ezra on 07-31-2006 at 08:52 AM

I'll try, shouldn't be too hard.

Might take some time, as I have a deadline for next week at work.

EDIT: Found out the script was a lot easier than I thought, so I have a working function already :-)

I'll explain what it does.

First It checks if it was you that sent the message, if not continue, then it look s at the message to see if the message contains Hey, if it does continue (notice: you can change this to any message you like).
Then it send Hi, back to the same conversation where you just received the message, now it starts looping trough all the open conversations and because one conversation should be skipped (the one where we just answered Hi) it checks the Handle of the window, if the handle is not the same it sends "Sorry, i'm busy right now".

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
  if (Origin != Messenger.MyName)
  {
    if (Message.match(/(^|\s+)Hey!?($|\s+)/i) != null)
    {
      ChatWnd.SendMessage("Hi");
      var e = new Enumerator(Messenger.CurrentChats);
      for(; !e.atEnd(); e.moveNext())
      {
        var ChatWindow = e.item();
        if (ChatWindow.Handle != ChatWnd.Handle)
        {
          ChatWindow.SendMessage("Sorry, i'm currently Busy");         
        }
      }
    }
  }
}


Another thing, please don't double post, there is an edit button.
RE: send a basic message by t0mmy9 on 07-31-2006 at 09:31 AM

ok sorry about that, thanks a lot, impressive script i dont think i would have been able to manage that on my own. thanks.

Edit:sorry i have added it to my script and it is failing to work. I assume someone else either had to type hi,hey or hey! my friend try them all and they all didn't work. i think i will just abort this idea my scripts getting too complicated.

edit again: sorry it does work i just changed a bit of it, thanks a lot for your help :D