Slight calc problem.

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

Synndic
orc pawn
orc pawn
Posts: 28
Joined: Sat Aug 09, 2003 9:51 am

Slight calc problem.

Post by Synndic » Sat Jul 24, 2004 2:26 pm

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?

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Sat Jul 24, 2004 2:43 pm

From the Announcements forum: http://macroquest2.com/phpBB2/viewtopic.php?t=7921

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

Synndic
orc pawn
orc pawn
Posts: 28
Joined: Sat Aug 09, 2003 9:51 am

Post by Synndic » Sat Jul 24, 2004 9:02 pm

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.