mickael9
Full Member
Posts: 117 Reputation: 3
33 / /
Joined: Jul 2005
|
RE: RE: Whats wrong with this?
quote: Originally posted by Hengy
(yes, it's me again... )
so i've got this:
code: var rndnumber = Math.floor(Math.random()*26);
function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
if(Msg == "!pick")
{
return "Pick a number between 0 and 25";
}
if(Msg == rndnumber)
{
return Command_Win();
}
function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Msg,MsgKind)
{
if(Msg == rndnumber)
{
return Command_Win();
}
}
}
function Command_Win()
{
return rndnumber + " was the correct number! ";
}
But the random number is only generated once, and if you try this script again without modifying the script (exiting the conv doesn't work) then the random number is still the same... Is there anyway to get around this?
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";
}
if(Msg == rndnumber)
{
return Command_Win();
}
function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Msg,MsgKind)
{
if(Msg == rndnumber)
{
return Command_Win();
}
}
}
function Command_Win()
{
rndnumber = null;
return rndnumber + " was the correct number! ";
}
This post was edited on 07-23-2006 at 01:49 AM by mickael9.
|
|