Ekaru2008-02-25 22:08:55
I'm trying to script an autosipper in ZMud and it seems to have trouble processing math operators. Specifically, I'm trying to get it to sip at 90% health, but I can't get this line to work:
#if (@sipbalance=1 AND @siphealth=1 AND @health/@maxhealth<.9 AND @health!=0) {sip health}
I tried #sa @health/@maxhealth and it just shows something like 3000/4000 instead of .75. Also, I tried to use \\ instead of /, but no luck with that either. If I change the condition to @health<@maxhealth, it starts working, but I don't want to sip when I lose only 1 hitpoint. Any help?
#if (@sipbalance=1 AND @siphealth=1 AND @health/@maxhealth<.9 AND @health!=0) {sip health}
I tried #sa @health/@maxhealth and it just shows something like 3000/4000 instead of .75. Also, I tried to use \\ instead of /, but no luck with that either. If I change the condition to @health<@maxhealth, it starts working, but I don't want to sip when I lose only 1 hitpoint. Any help?
Unknown2008-02-25 22:12:06
Try something like %eval(%float(@health)/%float(@maxhealth))? (The %eval shouldn't be necessary in the #IF, but it is for the #SAY.)
Ekaru2008-02-25 22:23:55
No luck. I'm testing it with mana so I can lower the value easily by using focus body. Here's what I tried:
#if (@sipbalance=1 AND @sipmana=1 AND %float( @mana)/%float( @maxmana)<.9) {sip mana}
and
#if (@sipbalance=1 AND @sipmana=1 AND %eval( %float( @mana)/%float( @maxmana))<.9) {sip mana}
Neither one fired when my mana dipped below 90%. It's definitely not a problem with the other variables either because they both returned 1 when I #sa them. Hmm, this is pretty tricky.
#if (@sipbalance=1 AND @sipmana=1 AND %float( @mana)/%float( @maxmana)<.9) {sip mana}
and
#if (@sipbalance=1 AND @sipmana=1 AND %eval( %float( @mana)/%float( @maxmana))<.9) {sip mana}
Neither one fired when my mana dipped below 90%. It's definitely not a problem with the other variables either because they both returned 1 when I #sa them. Hmm, this is pretty tricky.
Ilyarin2008-02-25 22:30:15
I personally use something comparable to '#if (@health < @healthMax * 0.9)' which will achieve the same thing.
Ekaru2008-02-26 00:26:20
Hey, that works perfectly. Thanks! For some reason it doesn't work if I use .9 instead of 0.9. Even with 0.9, I have to use @mana<@maxmana*0.9 instead of @mana/@maxmana<0.9. For some reason, the second one makes me sip whenever I lose any mana, even if it's still more than 90%.