mIRC Home    About    Download    Register    News    Help

Print Thread
Setting Timers with Variables #259885 08/02/17 03:01 PM
Joined: Jan 2017
Posts: 57
KubosKube Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 57
So I have this specific timer, as follows:

timerHealth.$nick $calc(%rpgMaxHealth.$nick - %rpgCurrentHealth.$nick) 15 inc %rpgCurrentHealth.$nick

The name works, the command works, but for whatever reason, the $calc() doesn't.
If %rpgCurrentHealth.$nick is 75 and %rpgMaxHealth.$nick is 100, then $calc(%rpgMaxHealth.$nick - %rpgCurrentHealth.$nick) should return 25, right?

So the timer SHOULD be
timerHealth.kuboskube 25 15 inc %rpgCurrentHealth.kuboskube

But instead it comes out
timerHealth.kuboskube 100 15 inc %rpgCurrentHealth.kuboskube

The EXACT code I'm using is
Quote:
timerHealth. [ $+ [ $nick ] ] $calc((%rpgMaxHealth. [ $+ [ $nick ] ] )- (%rpgCurrentHealth. [ $+ [ $nick ] ] )) 15 inc %rpgCurrentHealth. [ $+ [ $nick ] ]

Re: Setting Timers with Variables [Re: KubosKube] #259904 09/02/17 01:43 PM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Try "$!calc" - /timer requires "!" to re-evaluate ids.


Dont give a fish - teach to fish!
Re: Setting Timers with Variables [Re: splinny] #259907 09/02/17 01:55 PM
Joined: Jan 2017
Posts: 57
KubosKube Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 57
I actually ended up putting those timers in an alias and I removed the $calc to outside the timer, so instead it's

set %rpgMissingHealth.$nick $calc($2-$1)

timerRpg.regen.$nick %rpgMissingHealth.$nick 15 inc %rpgCurrentHealth.$nick

But if I ever need to put the calc straight into the timer, I'm gonna try your suggestion.