mIRC Home    About    Download    Register    News    Help

Topic Options
#201619 - 01/07/08 03:26 PM Delaying a WHILE loop
BIGZIPZ Offline
Ameglian cow

Registered: 16/02/06
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.

Top
#201620 - 01/07/08 03:35 PM Re: Delaying a WHILE loop [Re: BIGZIPZ]
Miguel_A Offline
Vogon poet

Registered: 31/08/03
Posts: 143
Loc: Portugal - Figueira Da Foz
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


Edited by Miguel_A (01/07/08 03:37 PM)

Top
#201621 - 01/07/08 03:40 PM Re: Delaying a WHILE loop [Re: Miguel_A]
BIGZIPZ Offline
Ameglian cow

Registered: 16/02/06
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.

Top
#201623 - 01/07/08 04:06 PM Re: Delaying a WHILE loop [Re: BIGZIPZ]
Miguel_A Offline
Vogon poet

Registered: 31/08/03
Posts: 143
Loc: Portugal - Figueira Da Foz
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.


Edited by Miguel_A (01/07/08 04:06 PM)

Top
#201624 - 01/07/08 04:19 PM Re: Delaying a WHILE loop [Re: Miguel_A]
Miguel_A Offline
Vogon poet

Registered: 31/08/03
Posts: 143
Loc: Portugal - Figueira Da Foz
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

Top
#201626 - 01/07/08 05:07 PM Re: Delaying a WHILE loop [Re: Miguel_A]
BIGZIPZ Offline
Ameglian cow

Registered: 16/02/06
Posts: 22
Thanks alot, I will take a look at it and try to understand it. Thanks

Top
#201636 - 01/07/08 07:25 PM Re: Delaying a WHILE loop [Re: BIGZIPZ]
AWEstun Offline
Fjord artisan

Registered: 02/05/08
Posts: 329
timer 1 5 msg #BIGZIPZ This is line %i / 3
_________________________
I registered; you should too.

Top
#201651 - 01/07/08 10:09 PM Re: Delaying a WHILE loop [Re: BIGZIPZ]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.


Edited by Tomao (01/07/08 10:11 PM)

Top
#201653 - 01/07/08 10:17 PM Re: Delaying a WHILE loop [Re: Tomao]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.

Top