mIRC Homepage
Posted By: Amar Timer based increment! - 17/10/03 11:14 AM
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.
Posted By: LocutusofBorg Re: Timer based increment! - 17/10/03 04:38 PM
Maybe if you tell us what exactly this is to accomplish? You cannot increment a variable used in a while loop outside that loop.
Posted By: Amar Re: Timer based increment! - 17/10/03 04:42 PM
This particular part of the script will be used to issue MOTD of our channels to all regulars laugh
Posted By: Chimera Re: Timer based increment! - 17/10/03 07:13 PM
Don't use a while loop. Just put the code inside the alias, and have the timer "self-call" the alias from inside it.
Posted By: Amar Re: Timer based increment! - 17/10/03 09:38 PM
What about using /timer 1 6 inc %i 1???
Posted By: Amar Re: Timer based increment! - 17/10/03 09:42 PM
The link you provided aint funtional, could you provide me a sample coding here?

Thanks
Posted By: Collective Re: Timer based increment! - 17/10/03 09:52 PM
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.
Posted By: Amar Re: Timer based increment! - 18/10/03 09:48 AM
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
© mIRC Discussion Forums