mIRC Home    About    Download    Register    News    Help

Print Thread
Timer based increment! #55440 17/10/03 11:14 AM
Joined: Aug 2003
Posts: 18
A
Amar Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Aug 2003
Posts: 18
Hello once again guys!

Please go through the code below and advice me how to increment a parameter on a set interval of time.
Code:
 while %i <= $nick(#,0,a) {
 .echo I am incrimenting after 6 seconds! %i
. timer 1 6 nexti }
alias nexti {
.inc %i 1 }
  

Whenever I tried, I end up with an infinite loop! which crashes my mIRC client.


if it is a door, it will open!
Re: Timer based increment! #55441 17/10/03 04:38 PM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Maybe if you tell us what exactly this is to accomplish? You cannot increment a variable used in a while loop outside that loop.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: Timer based increment! #55442 17/10/03 04:42 PM
Joined: Aug 2003
Posts: 18
A
Amar Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Aug 2003
Posts: 18
This particular part of the script will be used to issue MOTD of our channels to all regulars laugh


if it is a door, it will open!
Re: Timer based increment! #55443 17/10/03 07:13 PM
Joined: Dec 2002
Posts: 17
C
Chimera Offline
Pikka bird
Offline
Pikka bird
C
Joined: Dec 2002
Posts: 17
Don't use a while loop. Just put the code inside the alias, and have the timer "self-call" the alias from inside it.

Re: Timer based increment! #55444 17/10/03 09:38 PM
Joined: Aug 2003
Posts: 18
A
Amar Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Aug 2003
Posts: 18
What about using /timer 1 6 inc %i 1???


if it is a door, it will open!
Re: Timer based increment! #55445 17/10/03 09:42 PM
Joined: Aug 2003
Posts: 18
A
Amar Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Aug 2003
Posts: 18
The link you provided aint funtional, could you provide me a sample coding here?

Thanks


if it is a door, it will open!
Re: Timer based increment! #55446 17/10/03 09:52 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
How about this?
Code:
alias test {
  if ( $1 <= $nick(#,0,a) ) {
    echo -a I am incrimenting after 6 seconds! $1
    .timer 1 6 test $calc($1 + 1)
  }
}


Also you can break out of infinite loops using ctrl+break.

Re: Timer based increment! #55447 18/10/03 09:48 AM
Joined: Aug 2003
Posts: 18
A
Amar Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Aug 2003
Posts: 18
Thanks collective!
Since I had to complete the coding urgent, I kept on trying and somehow managed it with a rather lengthy coding. I am yet to try your code, which I will soon. I coded it as follows

Code:
 
menu status,channel {
.-
MsgThem
.Start:{
.set %c.counter 0
.timermsgdem 0 6 msgdem }
.-
.Stop:.timermsgdem off
}

alias msgdem {
.inc %c.counter 1
.set %cs.nick $nick(#,%c.counter)
.msg %cs.nick Welcome!
.halt
}
 


and it works...Thanks for the replies laugh


if it is a door, it will open!