|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
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
|
|
|
|
Joined: Feb 2003
Posts: 83
Babel fish
|
Babel fish
Joined: Feb 2003
Posts: 83 |
u can try putting it on a timer
any help would make me happy
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
well i tryed a timer on the command like
while ( %t <= %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
|
|
|
|
Joined: Feb 2003
Posts: 83
Babel fish
|
Babel fish
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
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
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 ?
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
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 ?
|
|
|
|
Joined: Dec 2002
Posts: 1,527
Hoopy frood
|
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
|
|
|
|
Joined: Feb 2003
Posts: 83
Babel fish
|
Babel fish
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
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
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...
|
|
|
|
Joined: Dec 2002
Posts: 1,527
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,527 |
D3m0nnet.com
|
|
|
|
Joined: Dec 2002
Posts: 1,527
Hoopy frood
|
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
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
well that last part is what i am talking about 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 ........
var %z = $lines(blah.txt)
var %t = 1
while ( %t <= %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
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
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?
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
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
|
|
|
|
Joined: Feb 2003
Posts: 83
Babel fish
|
Babel fish
Joined: Feb 2003
Posts: 83 |
can u give me a good tutorial link if there is one for the mdx dll please thx again.
any help would make me happy
|
|
|
|
Joined: Feb 2003
Posts: 83
Babel fish
|
Babel fish
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
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
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
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
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 ?
|
|
|
|
|