mIRC Home    About    Download    Register    News    Help

Print Thread
Delaying a WHILE loop #201619 01/07/08 02:26 PM
Joined: Feb 2006
Posts: 22
B
BIGZIPZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Feb 2006
Posts: 22
I have an extremely simple piece of code, lifted mostly from the mIRC help file:

Code:
var %i = 1
while (%i <= 3) {
msg #mychannel This is line %i / 3
inc %i
}


As it stands when that runs it quickly sends three lines to the channel. Are there any special commands I could add to it so that it sends the message, then waits, say 5 seconds, before continuing the loop as normal.

As it is all three lines of text are send in a split second because the loop obviously completes itself quickly. I just need it to send the message, wait a bit, then continue processing the loop as normal and sending the next message and so on.

I have read about /halt, /break, /continue, and /return commands but the help file isn't that useful.

Thank you.

Re: Delaying a WHILE loop [Re: BIGZIPZ] #201620 01/07/08 02:35 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Hi.

in the while you put a break and them you active the timer.
You must use a timer that will be execute the continue command.

And the help is very usefully, you need only to understand it and know how to play with the commands the mIRC offers.

good luck

Last edited by Miguel_A; 01/07/08 02:37 PM.
Re: Delaying a WHILE loop [Re: Miguel_A] #201621 01/07/08 02:40 PM
Joined: Feb 2006
Posts: 22
B
BIGZIPZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Feb 2006
Posts: 22
Thank you for the reply. Do you mean like this:

Code:
  var %i = 1
  while (%i <= 3) {
    msg #BIGZIPZ This is line %i / 3
    timer 1 5 continue
    inc %i
    break
  }


I added the 5 second timer to try and make the thing pause for 5 seconds before sending the next message but it doesn't seem to work.

Thanks again.

Re: Delaying a WHILE loop [Re: BIGZIPZ] #201623 01/07/08 03:06 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
hi.

I guess that should work but itīs not working
well i have try ti and i guess i am wrong...

Wait a sec to try other thing.

Last edited by Miguel_A; 01/07/08 03:06 PM.
Re: Delaying a WHILE loop [Re: Miguel_A] #201624 01/07/08 03:19 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
hi.

Try something like this...

Code:
alias test {
  set %i $1
  if ( %i <= 3 ) {
    goto WriteMessage
  }
  else {
    goto EndWriteMessage
  }
  :WriteMessage
  echo -s Message Nrš %i
  set %i $calc( %i + 1)
  timerNextMsg 1 5 test %i
  halt
  :EndWriteMessage
  echo -s End Message
  halt
}


try to understand the code to build one your self... I think itīs easy to understand it...

good luck

Re: Delaying a WHILE loop [Re: Miguel_A] #201626 01/07/08 04:07 PM
Joined: Feb 2006
Posts: 22
B
BIGZIPZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Feb 2006
Posts: 22
Thanks alot, I will take a look at it and try to understand it. Thanks

Re: Delaying a WHILE loop [Re: BIGZIPZ] #201636 01/07/08 06:25 PM
Joined: May 2008
Posts: 329
A
AWEstun Offline
Fjord artisan
Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
timer 1 5 msg #BIGZIPZ This is line %i / 3


I registered; you should too.
Re: Delaying a WHILE loop [Re: BIGZIPZ] #201651 01/07/08 09:09 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
var %i = 1
while (%i <= 3) {
  .timer 1 $calc(%i * 5) msg # This is line %i / 3
  inc %i
}


That should set a 5 second delay looping between each line.

Last edited by Tomao; 01/07/08 09:11 PM.
Re: Delaying a WHILE loop [Re: Tomao] #201653 01/07/08 09:17 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Sorry, but all that will do is delay the time that the message is sent to the channel, not the actual loop, as the inc %i is located outside of the /timer command.