mIRC Homepage
Posted By: Clyde_The_Glide guessing game - 05/10/05 10:59 AM
Code:
 

;Num Game
on 10:text:*:#:{
  if (!nstart iswm $1) && (!%numg. [ $+ [ $address($nick,2) ] ]) {
    if ($1 != !guess) {    
      set %num $rand(1,99)
      set %ngame 1
      msg # Guessing game is on.    
    }
  } 
  elseif (%ngame == 1) && ($1 == !nguess) && ($2 == $null) {
    notice $nick SYNTAX: !guess <number>
  }
  elseif (!guess* iswm $1) && (%ngame == 0) {
    notice $nick Game is currently down.
    inc -z %numg. [ $+ [ $address($nick,2) ] ] 900 
  }
  elseif (!guess* iswm $1) && ($2 < %num) {
    notice $nick $2 is too low.
    inc -z %numg. [ $+ [ $address($nick,2) ] ] 900
  }
  elseif (!guess* iswm $1) && ($2 > %num) { 
    notice $nick $2 is too high.
    inc -z %numg. [ $+ [ $address($nick,2) ] ] 900 
  }
  elseif (!guess* iswm $1) && ($2 == %num) {
    msg # $2 is Correct! $nick is the winner.
    set %num $rand(1,99)
    hinc -m nwinners %numg. [ $+ [ $nick ] ] %win
  }
 else { 
    notice $nick You must wait $duration(%numg. [ $+ [ $address($nick,2) ] ] )
  }
}  



problem is - the bot is not ignoring :\

hope you can help. smile
Posted By: Kelder Re: guessing game - 05/10/05 11:28 AM
if (!nstart iswm $1) && (!%numg. [ $+ [ $address($nick,2) ] ]) {

There's no space between those 2, so the ] is taken as text and not as the evaluation-changing symbol.
Posted By: Clyde_The_Glide Re: guessing game - 05/10/05 11:42 AM
Now he's telling me how much time left every time I write something that's not starting with !guess,and he's not telling how much time left after I type !guess more then one time. :X
Posted By: Riamus2 Re: guessing game - 05/10/05 01:10 PM
Well, it will always respond because you said that if nothing else is true, to reply with the time. Assuming that part is so that someone has to wait X amount of time between guesses, here's a fix...

(I've also made your code a bit faster for you by splitting out the !guess* iswm section and cleaned it up a bit so that your guesses must include a number after !guess)

Code:
 

;Num Game
on 10:text:*:#:{
  if (!nstart == $1) && (!%numg. [ $+ [ $address($nick,2) ] ]) {
    set %num $rand(1,99)
    set %ngame 1
    msg # Guessing game is on.    
  } 
  elseif ($1 == !guess && $2 isnum) {
    if (%ngame == 0) {
      notice $nick Game is currently down.
      inc -z %numg. [ $+ [ $address($nick,2) ] ] 900 
    }
    elseif (%numg. [ $+ [ $address($nick,2) ] ] != $null) {
      notice $nick You must wait $duration(%numg. [ $+ [ $address($nick,2) ] ] )
    }
    elseif ($2 < %num) {
      notice $nick $2 is too low.
      inc -z %numg. [ $+ [ $address($nick,2) ] ] 900
    }
    elseif ($2 > %num) { 
      notice $nick $2 is too high.
      inc -z %numg. [ $+ [ $address($nick,2) ] ] 900 
    }
    elseif ($2 == %num) {
      msg # $2 is Correct! $nick is the winner.
      set %num $rand(1,99)
      hinc -m nwinners %numg. [ $+ [ $nick ] ] %win
    }
  }
  elseif ($1 == !guess && $2 !isnum) {
    notice $nick SYNTAX: !guess <number>
  }
}  

Posted By: Clyde_The_Glide Re: guessing game - 05/10/05 01:53 PM
Tthanks,but
it's sending twice :X
Code:
  
12(16:52:23) (12~bnz420) !guess 44
12(16:52:24) -prophet- 44 is too high.
12(16:52:24) -prophet- 44 is too high.
Posted By: Riamus2 Re: guessing game - 05/10/05 02:20 PM
Are you sure you don't have your original script in there as well? This shouldn't be able to send it twice. Do a search through all your scripts for "is too high" and see if it's there more than one place.
Posted By: Clyde_The_Glide Re: guessing game - 05/10/05 05:07 PM
yeah,you were right.
Thank you very very much! smile
Posted By: Bullseye Re: guessing game - 05/10/05 06:01 PM
Isn't it much easyer to just download a higher/lower game ?
© mIRC Discussion Forums