mIRC Home    About    Download    Register    News    Help

Print Thread
[Solved] How to use while loops? #261528 17/10/17 11:18 PM
Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
Code
Quote:

/hmake guessgame
/hmake score

on *:text:!guess *:#:{
if ($regex($2,^[1-24]$)) {
/hadd -ms guessgame $nick $2-
}
}

on *:text:!winner *:#:{
var %w = $hfind(guessgame, $2-,0).data
var %i = 1
while (%i <= %w){ ;<-- this was incorrect
//echo -a $hfind(guessgame, $2-,1).data
/hdel guessgame $hfind(guessgame, $2-,1).data
inc %i
}
}

Last edited by G16; 18/10/17 03:29 AM. Reason: question was solved
Re: How to use while loops? [Re: G16] #261531 18/10/17 01:48 AM
Joined: Jan 2004
Posts: 1,212
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,212
the first time you had the curly brace touching the parenthesis in front of it, the 2nd time you had the curly brace on the next line. Just have the curly brace on same line as the while:

Code:
while (condition to end loop) {
  stuff
}

Re: How to use while loops? [Re: maroon] #261533 18/10/17 03:13 AM
Joined: Oct 2017
Posts: 8
G16 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Oct 2017
Posts: 8
LoL
Thanks man, you rock!