Skip to content
MSN

slow loop

A TG007 community discussion started by DreaM.

Discussion 5 posts
Page 1 of 1
Open
Topic #3631 · 5 published posts · 704 views

hi guys, I have this loop:

alias test {
 var %n 1
 while (%n <= $lines(file.txt)) {
   if ($1 isin $gettok($read(file.txt,%n),1,32)) {
    echo -a %n
   }
   inc %n
 }
}

 

I know it is very simple one but what if file.txt is very big and i want the loop to be done without freezing my mirc? is there anyway to control the speed of the loop?

mIRC will continue, regardless of how large a file is. I've made mIRC search through over 200GB of data several times in the past; it just takes a short while for it to start displaying the data.

 

Otherwise, try dividing the while loop up to search a certain amount of lines at a time.

alias test {
 set %test.a $lines(file.txt)
 set %test.b $calc($lines(file.txt) / 100)
 set %test.c 1
 timertest -c %b 30 test.loop
}
alias test.loop {
 var %n = 1
 if (%test.c <= %test.b) {
   while (%n <= 100) {
     command $read(file.txt,$calc((%test.c * %test.b) + n)
     inc %n
   }
   inc %test.c
 }
 else { halt }
}

I believe that will work.

 

hmm isnt there a dll for while loops so it wont freeze mirc up

edit: whilefix.dll , not sure if it works though

Edited May 25, 2005 1:10 AM by Seph

yes whilefix.dll works, i use it and it's a nice little addative to a long loop.

thank you all specially Seph