mIRC Home    About    Download    Register    News    Help

Print Thread
Need help with timers and $(rand) #259483 05/12/16 09:18 AM
Joined: Mar 2016
Posts: 50
T
TUSK3N Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Mar 2016
Posts: 50
So I want to start a timer that is infinite but it will only make the $rand random the first time I activate it.

/timertest 0 $rand(120,360) msg $chan bla bla bla

So this will choose a random number once and then repeat it everytime but I want it to be a random timer each time it has said bla bla bla.

How its working right now.

timer activated on 125 sec
Me: bla bla bla
timer activated on 125 sec
Me: bla bla bla

How it should work.

timer activated on 145
Me: bla bla bla
timer activated on 356
Me: bla bla bla

so its random everytime I hope you understand.

Re: Need help with timers and $(rand) [Re: TUSK3N] #259484 05/12/16 01:37 PM
Joined: Jun 2015
Posts: 84
F
Fonic_Artes Offline
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
Seems like you could do something like.

Code:
if ($timer_test.type == online) {
.timer_test off
.timer_test 0 $rand(120,360) STUFF
}

else {
.timer_test 0 $rand(120,360) STUFF
}

Re: Need help with timers and $(rand) [Re: TUSK3N] #259491 08/12/16 01:52 AM
Joined: Jan 2004
Posts: 1,322
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,322
/timertest 0 $!rand(120,360) msg $chan bla bla bla

Re: Need help with timers and $(rand) [Re: Loki12583] #259496 08/12/16 06:12 PM
Joined: Jul 2006
Posts: 3,774
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,774
That does not work, only the command parameter of /timer is evaluated twice, the delay and repetition are not part of the command, you can use the same idea with just one more timer though


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Need help with timers and $(rand) [Re: TUSK3N] #259498 08/12/16 07:44 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
alias test { 
  .timertest 1 $rand(120,360) test 
  msg $chan bla bla bla
}


If you don't want the msg to trigger the first time you run /test then you can do:

Code:
alias test {
  .timertest 1 $rand(120,360) test -m
  if ($1 == -m) { msg $chan bla bla bla }
}


/test