Divide By Zero
Posted: Wed Aug 18, 2004 4:11 pm
Someone posted the code for a mana regen timer sometime before (Tells you how long before you are FM). I added it to my UI, but when I play a character without mana I get a Divide by Zero in Calculation error... so I added an if statement around it
Without If:
With If:When I use the If statement, it dissapears from the UI, but I still get a Divide by Zero error. Is there an error in my code (I am new at this) or does MQ just do the equations anyway (Seems pretty inefficient if it does)?
Without If:
Code: Select all
${If[${Math.Calc[${Me.CurrentMana}/${Me.MaxMana}]}==1,"",${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}/10]}]}:${If[${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]}>9,${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]},0${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]} -- ]}]}${Me.CurrentMana}/${Me.MaxMana}:${Me.ManaRegen}Code: Select all
${If[${Me.MaxMana}==0,"",${If[${Math.Calc[${Me.CurrentMana}/${Me.MaxMana}]}==1,"",${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}/10]}]}:${If[${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]}>9,${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]},0${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]} -- ]}]}${Me.CurrentMana}/${Me.MaxMana}:${Me.ManaRegen}]}