I was just asked an interesting question. How to make a random "guess the numnber" script?


on *:TEXT:!guessnumber:#:{ }

I think it should be fairly simple, but I don't know anything about identifiers for randomness and such.

I trolled through the help and looked for random stuff. This is what I have come up with:

on *:TEXT:!guessnumber*:#:{
  set %guessnumbernum $rand(0,100) 
  echo -a The number is %guessnumbernum
  if ($2 == $null) { msg $chan Pick a number. Syntax is !guessnumber number }
  elseif ($2 != %guessnumber) {
    msg $chan Sorry, that's not the number. Try again?
    unset %guessnumbernum
  elseif ($2 == %guessnumber) {
    msg $chan YOU WIN!
    unset %guesssnumbernum
  else { halt }

Last edited by Mpot; 25/09/07 10:19 PM.