mIRC Homepage
Posted By: Alltech while loops - 11/03/04 01:57 PM
on *:input:#:{
if (/* !iswm $1-) { var %i = 1,%str = d det r er | while ($gettok(%str,%i,32)) { while ($istok($1-,$gettok(%str,%i,32),32)) { tokenize 32 $reptok($1-,$gettok(%str,%i,32),$gettok(%str,$calc(%i + 1),32),1,32) } | inc %i 2
} | say $1- | halt } }


If you try to put all that in 1 line, it wont work.. No errors or anything, but it just dont do the reptok..
Posted By: tidy_trax Re: while loops - 11/03/04 02:15 PM
why would you want it all on one line?
it looks horrible
Posted By: Alltech Re: while loops - 11/03/04 02:23 PM
hehe, thats not the point :P

I was gonna post it in a channel, so i wanted it all in one line, but I noticed that the $reptok didnt work when I did smirk confused
Posted By: Online Re: while loops - 11/03/04 04:41 PM
Maybe it is related to this thread...
Posted By: Adrenalin Re: while loops - 11/03/04 05:53 PM
Works just fine here grin
I type in a channel d.. And it was replaced with det..
Also i type r.. And it was replaced with er..
So.. Script works fine.. But it is not very readable..
How about somethink like that ?

Code:
on *:input:#:{
  if (/* !iswm $1-) { 
    var %i = 1
    %str = d det r er 
    while ($gettok(%str,%i,32)) { 
      while ($istok($1-,$gettok(%str,%i,32),32)) {
        tokenize 32 $reptok($1-,$gettok(%str,%i,32),$gettok(%str,$calc(%i + 1),32),1,32) 
      } 
      inc %i 2
    }
    say $1- 
    halt 
  } 
}
Posted By: Alltech Re: while loops - 11/03/04 05:53 PM
i did some testing and found out that mIRC skips the first while loop when the 2'nd is done.. i just dont think mIRC likes double while loops in one line... :tongue:
Posted By: Adrenalin Re: while loops - 11/03/04 06:24 PM
Err.. Yap.. That not work in 1 line.. But if i copy&paste exact the script in first post(in 3 lines).. It work fine..
Ok.. Here is a more good version to demonstrate the bug.. (zzz sorry for english ;P)

on *:input:#:{ var %i = 1 | var %y = 1 | while (%i <= 100) { echo bheee | while (%y <= 100 ) { echo muuu | inc %y } | inc %i } | echo Cows Win ! }

That script(put all in one line) demonstrate what you say.. It will echo 100 times muuu and only one bheee wink
Posted By: tidy_trax Re: while loops - 11/03/04 06:55 PM
Quote:
I was gonna post it in a channel, so i wanted it all in one line

<offtopic>
i'd like to introduce you to nomorepasting.com smile
</offtopic>
Posted By: Iori Re: while loops - 11/03/04 07:13 PM
mIRC hasn't handled more that one while loop on a single line for at least several versions.
© mIRC Discussion Forums