mIRC Homepage

Setting Timers with Variables

Posted By: KubosKube

Setting Timers with Variables - 08/02/17 03:01 PM

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 ] ]
Posted By: splinny

Re: Setting Timers with Variables - 09/02/17 01:43 PM

Try "$!calc" - /timer requires "!" to re-evaluate ids.
Posted By: KubosKube

Re: Setting Timers with Variables - 09/02/17 01:55 PM

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.
© 2022 mIRC Discussion Forums