Unknown2010-11-24 17:52:18
Okay so I am trying to make an auto-sipper for zmud but am having issues with the math part...trying to get it to take my maxhealth and set the siphealth variable to 80% of maxhealth...any help?
And before anyone asks...I would be on Mushclient but I can't get trent to work and I have no clue how to script in it...so hence zmud...
And before anyone asks...I would be on Mushclient but I can't get trent to work and I have no clue how to script in it...so hence zmud...
Lendren2010-11-24 20:11:06
#math siphealth (@maxhealth * 8) / 10
Placeus2010-11-26 01:55:44
QUOTE (Lendren @ Nov 25 2010, 06:41 AM) <{POST_SNAPBACK}>
#math siphealth (@maxhealth * 8) / 10
Pretty sure that will do integer division so you'll end up with 1 or 0.
Try either
CODE
#math siphealth (%float(@maxhealth) * 0.8)
or to do it as an inline staement
CODE
#if (@current_health < %eval(%float(@max_health) * 0.8)) {sip health}
Lehki2010-11-26 02:12:04
CODE
#if (((@current_health*100) / @max_health) < 90) {sip health}
That's what I use, basically. <__<
Lendren2010-11-26 02:50:07
QUOTE (Placeus @ Nov 25 2010, 08:55 PM) <{POST_SNAPBACK}>
Pretty sure that will do integer division so you'll end up with 1 or 0.
No, that's why the parentheses are where they are. Try it, it works. You can test it thus:
#show %eval((4000 * 8) / 10)
It's a lot faster than the float version. (Not important if this only happens rarely, like this, but can make a huge difference on something that happens inside the prompt or a loop.)
Placeus2010-11-26 08:40:59
I suppose it doesn't really matter because max health is such a high number.
If you look at your example with a max health of 4001 you get #show %eval((4001 * 8) / 10) = 3200 which is out by 0.8!!!
Um yeah, really doesn't matter unless you're doing a 50% mana/ego tracker.
If you look at your example with a max health of 4001 you get #show %eval((4001 * 8) / 10) = 3200 which is out by 0.8!!!
Um yeah, really doesn't matter unless you're doing a 50% mana/ego tracker.