Page 1 of 1

Slight calc problem.

Posted: Sat Jul 24, 2004 2:26 pm
by Synndic
I've seen the spell cast count mod some people have done to their UI and applied it to my own. Works fine. I've recently wanted to add 1 decimal place to the result so I can tell if I'm close to being able to cast it, so I get a 0.9 instead of a 0

Anyway the problem I have is I get a "divide by zero in calculation" error whenever a spellgem is empty.

Code goes as

Code: Select all

${Float[${If[${Me.Gem[2].Mana}==0,0.0,${Math.Calc[${Me.CurrentMana}/${Me.Gem[2].Mana}]}]}].Deci}
Also tried placing the float inside the if statement. Can anyone see the problem that I am missing?

Posted: Sat Jul 24, 2004 2:43 pm
by ieatacid
From the Announcements forum: http://macroquest2.com/phpBB2/viewtopic.php?t=7921

There are also other topics on fixing this, just search.

Posted: Sat Jul 24, 2004 9:02 pm
by Synndic
Oops.

The whole point of the if was to stop the whole div by 0 problem. I thought there was a problem with my logic, not the fact it was my understanding of how If statements were resolved. I had no reason to search becuase I thought it was a problem I was creating not 1 that was created for me.

But thank you for pointing me in the right direction, should be able to solve it now.