mIRC Home    About    Download    Register    News    Help

Print Thread
#236421 24/02/12 11:10 PM
Joined: Feb 2012
Posts: 4
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Feb 2012
Posts: 4
hey i need help with a script that will do this: X is a random number between 1 and 2
if the number is 1 do the /msg $chan number is one
if the number is 2 do the /msg $chan number is two


this is what i want it to do.
i have tried this:

Code:
on 1:text:!command:#: {
  set %number == $rand(1,2)

  if (%number == 1) { msg $chan is %number 1 }
  elseif (%number == 2) { msg $chan  is %number 2 }

}


Last edited by mircea33; 24/02/12 11:11 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Unless you need the variable to be global, use /var instead of /set. A single = is the assignment operator, and is (optionally) used with /var, but not with /set.

Code:
on 1:text:!command:#: {
  var %number = $rand(1,2)

  if (%number == 1) { msg $chan %number is one }
  elseif (%number == 2) { msg $chan %number is two }

}

Joined: Feb 2012
Posts: 4
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Feb 2012
Posts: 4
thank you kind sir!
it works perfectly!


Link Copied to Clipboard