mIRC Homepage
Posted By: BIGZIPZ Delaying a WHILE loop - 01/07/08 02:26 PM
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.
Posted By: Miguel_A Re: Delaying a WHILE loop - 01/07/08 02:35 PM
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
Posted By: BIGZIPZ Re: Delaying a WHILE loop - 01/07/08 02:40 PM
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.
Posted By: Miguel_A Re: Delaying a WHILE loop - 01/07/08 03:06 PM
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.
Posted By: Miguel_A Re: Delaying a WHILE loop - 01/07/08 03:19 PM
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
Posted By: BIGZIPZ Re: Delaying a WHILE loop - 01/07/08 04:07 PM
Thanks alot, I will take a look at it and try to understand it. Thanks
Posted By: AWEstun Re: Delaying a WHILE loop - 01/07/08 06:25 PM
timer 1 5 msg #BIGZIPZ This is line %i / 3
Posted By: Tomao Re: Delaying a WHILE loop - 01/07/08 09:09 PM
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.
Posted By: RusselB Re: Delaying a WHILE loop - 01/07/08 09:17 PM
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.
© mIRC Discussion Forums