code:var rndnumber;
function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
if(Msg == "!pick")
{
rndnumber = Math.floor(Math.random()*26);
return "Pick a number between 0 and 25";
}
}
function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Message,MsgKind)
{
if(Message == rndnumber)
{
Command_Win(Wnd);
}
}
function Command_Win(Wnd)
{
Wnd.SendMessage(rndnumber + " was the correct number! ");
}
This code is fully working, when you send !pick it tells you AND the contact "Pick a number between 0 and 25". When you or the contact get the number right it now says you have won It generates the random number each time you say !pick.
Cloudy
Edit: Beaten to it, but my alteration works correctly It now picks wins from both the contact and the sender, as you don't need both send and recieve for that as any messages you send count as recieved messages aswell. It also now returns the win to the conversation window properly once someone gets it right. Before what it would have done was alter the recieved message on your end.
try to say the number twice
This post was edited on 07-23-2006 at 06:05 PM by mickael9.