mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 282
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
I want that a while loop will have a delay.

So I created a loop using a /timer 1 1 goto backto

But it gives me an error.

Is there a way to put a goto inside a timer?

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
once the 'goto' executes it wont be able to go there because the command will of finished.


new username: tidy_trax
Joined: Feb 2003
Posts: 282
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
So, is there a way to create a loop with delay. I mean every second it increase the counting, and execute the right command using the counter (for example counter 1, then counter 2 .....)??

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
eh?


new username: tidy_trax
Joined: Feb 2003
Posts: 282
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
What I wanted to do is:

var %b = 1
:backto
counter %b
inc %b
.timer 1 1 goto backo


But it doesn't work.

Is there any other way?

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Code:
alias slowloop {
  if ( $1 < 10 ) {
    echo -a $1
    .timer 1 1 slowloop $calc($1 + 1)
  }
}

/slowloop 1

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
var %b = 1
counter %b
inc %b
.timer 1 1 signal blah %b

on *:SIGNAL:blah:{
var %c $1
counter %c
inc %c
.timer 1 1 signal blah %c
}



Last edited by pheonix; 23/09/03 02:28 PM.

new username: tidy_trax
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
That doesn't work since %b is a local variable.

Joined: Feb 2003
Posts: 282
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
Nice solution collective grin grin

I find a solution by 2 aliases. I triggers the counter , and the other one is the function that the counter excecute. It seems to be working, altough your solution looks better.

Thanks.

Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Why do you want the delay to begin with. Often the best way will be to issue a command, and have the next step in the loop be triggered by an event. If you want a delay because you are waiting for some task to be completed for instance.

Say I want to add 10 nicks to a akick list in chanserv. I could then send the command to add the first and then use the on notice event to trigger on chanserv's response, and then send the second command, etc.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Link Copied to Clipboard