mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#16801 25/03/03 01:56 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
if i am using something like
while ( %t <= %z ) {
dostuff
inc %t
}

is it possible to slow down the loop so it doesnt proccess so quickly ? maybe like pause before it goes back to the top thx in advance for any help smile

#16802 25/03/03 01:59 AM
Joined: Feb 2003
Posts: 83
L
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
u can try putting it on a timer



any help would make me happy
#16803 25/03/03 02:03 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well i tryed a timer on the command like
Code:
  
while ( %t &lt;= %z ) { 
 .timer1 1 4 dostuff 
  inc %t
}



the problem is say %z is 20 well it mght hit on line 1 then line 5 then line 11 then line 17 etc...
? if that makes any sense .. lol

#16804 25/03/03 02:13 AM
Joined: Feb 2003
Posts: 83
L
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
more like this, sorry, shoulda been more specific

.timerlk 0 3 do.this

alias do.this {
if ( %t <= %z ) {
do stuff
inc %t
}
if (%t > %z) { .timerlk off }
}


any help would make me happy
#16805 25/03/03 02:22 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ok sorry but i didnt quite understand that either ? i dont see how that is going to pause the loop ?
i understand seting the timer on the alias but i need to pause the while loop for say 3 secs because if %z is 6 with the script i put above 6 is the only result you will get as it has cycled thru the loop i am assuming to fast for anything else to process ?

#16806 25/03/03 02:32 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
I'm lost...why exactly do you need to pause the loop? The loop you have looks fine to me.. It would be easier if we knew what you were trying to accomplish.

#16807 25/03/03 02:41 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well what i want to do is send lines of text to a channel i can do this easily in other ways but i hadent used while loops much so i was just trying to work with them a bit to perform this function the script basically works but if the numberof lines is 6 the script only sends line 6 and skips the rest ? so i am just trying to learn/utilize the while loop feature in order to get away from further scripting gogo loops in future scripting ?


#16808 25/03/03 03:04 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
i can think of several reason ud want to pause a while loop ... one i can name offhand would be on my nicklst script ive made ..... ive had to actually set a timer now into the script to allow for certain variables to be setup when the loop starts to execute ... in order for it to actually work and compile my nicklist correctly ...... i know it doesnt sound like it would need to but ...... when u start setting icons into a nicklist using mdx ..... u can also set icons on away nicks ... to get the away nicks u have to do a who of tha chan and look for a G in $7 of the returned nicks ..... in a loop .. then set each nick it finds that g in $7 of its line into a variable ..... then u ned to start to compile the nicklist once u get all those nicks....... now to do this u have to also hold off and sort thru the variable u created with the away nicks ...... so u have to get all the nicks compare each one to whatss in that variable then if it matches set its approriate icon now its not so hard to payse it all if when u set ur event trigger up like on join who $chan | timer 1 1 alias of nicklist compiler

now u would have to do that on each and every possible nicklist change have a timer to hold it off while it compiles away nicks then it starts to sort thru it ... now on nick changes u actually have to set a timer on the who $chan and then increase the timer on the nicklist compiler by one ....... what ive noticed is if there was the ability to pause the loop to allow for some of thsese variable to be set then it would make it alot easier ... as i had to figure these lil tricks out without having clue why things werent setting or compiling correctly ...... so to have the ability to pause a loop for say a second would be a completely awesome idea .. it would allow for certain variavbles to be set and u could include other things inside the loop that uve had to otherwise exclude because of these slight limitations ...... but really if u cant pause ur loop there are other ways around what ur tryin to accomplish ... so i guess in the end its all just a thought of ok should this be like this or should it be left to do alternativly ...... say u wanted to set a variable then read from that variable inside the loop then reset that variable again and perform the loop ... ive had trouble where it actually wont read that variable from the loop because it doesnt set it fast enough to read from inside the loop and ended up with a blank list of nothing ........


D3m0nnet.com
#16809 25/03/03 03:11 AM
Joined: Feb 2003
Posts: 83
L
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
ahhhhhhhhhhhh


_D3m0n_: can u give me a direct link to mdx please?

if thats to much, jus a link where i can get it ?
thx.


any help would make me happy
#16810 25/03/03 03:13 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
I didn't say there were no reasons to pause I loop, I asked why he was doing it...

#16811 25/03/03 03:15 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527


D3m0nnet.com
#16812 25/03/03 03:17 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
granted ..... but i figured id add my 2 cents in to give a few reasons of why i thought while loops should be able to have a pause in them........ again its just a discussion .... just sharing my ideas


D3m0nnet.com
#16813 25/03/03 03:19 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well that last part is what i am talking about
Quote:

say u wanted to set a variable then read from that variable inside the loop then reset that variable again and perform the loop ... ive had trouble where it actually wont read that variable from the loop because it doesnt set it fast enough to read from inside the loop and ended up with a blank list of nothing ........


Code:
  
 var %z = $lines(blah.txt)
  var %t = 1
  while ( %t &lt;= %z ) {  
  .timer1 1 4 msg $active $read(blah.txt,%t)   
  inc %t
}
}


now lets say %z = 6
if your lucky you get line 6 because it is inc'd to 7 before anything can happen
thats the best i can figure out as to what the problem is

#16814 25/03/03 03:30 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
With that code you posted everytime it goes through the loop it resets timer "1" and tells it to msg the channel with line %t. Because of that the timer can only ever finish once (because the only time you don't reset it is when the loop has finished), so I guess that there are 6 lines in your text file?

#16815 25/03/03 03:31 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
correct 6 lines in the file but even if i take the timer out it only responds with one line ? i added the timer thinking it would help but it didnt

#16816 25/03/03 03:32 AM
Joined: Feb 2003
Posts: 83
L
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
can u give me a good tutorial link if there is one for the mdx dll please

thx again.

smile


any help would make me happy
#16817 25/03/03 03:34 AM
Joined: Feb 2003
Posts: 83
L
Babel fish
Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
var %z = $lines(blah.txt)
var %t = 1
while ( %t <= %z ) {
.timer $+ %t 1 4 msg $active $read(blah.txt,%t)
inc %t
}
}

should work for ya


any help would make me happy
#16818 25/03/03 03:38 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Why name the timers at all? They might disrupt other timers that have been automatically assgined numbers by mIRC...

And for the record your (cheech) script worked fine when I took out the timer so I have no idea why it didn't work for you.

#16819 25/03/03 03:39 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well that would probably work but if the file had 75 lines you would flood out beacuse they will all trigger at once

#16820 25/03/03 03:44 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well thats weird i took the timer out aswell and it works now ? but just to make sure i understand after al this ? there is actually no pause for the loop ?

Page 1 of 2 1 2

Link Copied to Clipboard