Shoutbox

[help] functions at WLM? - 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: [help] functions at WLM? (/showthread.php?tid=75892)

[help] functions at WLM? by bloodcrush on 07-05-2007 at 08:38 PM

Hi, I'm new to JS and to messenger plus script too.
i decided to create my own game but i don't know functions in messenger.

so, how can i check if someone said, for example"!start" or "!guess 777".
and lets say, that if "!guess 777" is true so print "congrats"?


thank you all.


RE: [help] functions at WLM? by Chris4 on 07-05-2007 at 08:41 PM

The Official Scripting Documentation and the Windows Script Documentation may come in handy. (Y)


RE: [help] functions at WLM? by MrT on 07-06-2007 at 08:20 AM

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
if(Origin != Messenger.MyName) {
    if(Message == "!start") { ChatWnd.SendMessage("Game Started");
    }
}
}

it's a good example :D
RE: [help] functions at WLM? by roflmao456 on 07-06-2007 at 09:55 PM

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
var rand = Math.floor(Math.random()*1000);
if(Origin != Messenger.MyName) {
if(Message.substr(0,6) == "!guess" && Message.substr(8) == rand) { ChatWnd.SendMessage("Congrats.");
}
}
}

was too lazy so copied from MrT's code :P

it's like a Guess my number game ;)

but if you want to set it on your own, just change "var rand"'s value