
jotun2011 Beginner
Joined: 06 Apr 2012 Posts: 19

Posted: Sun Apr 22, 2012 9:21 am
how to do the #MATH? 
So I got a problem....
I want to caclulate the precentage of successrate for assassinate for my character
I have made the following stuff....
an alias that will add 1 to attempt for every attempts
a trigger that will, upon success, add 1 to mortal
Lets say that @attempt are 225
and @mortal is 16
How do I make an trigger/alias etc to be able to caclulate the precentage of success?
cause the easy way...
#math prec1 (@attempts@mortal)
#math prec2 ((@prec1/@attempts)*100)
just wont work...it returns a 0 on the second #math, even when just using #MATH prec2 (@prec1/@attempts) will return a value of 0 



mikeC130 Wanderer
Joined: 03 Jul 2006 Posts: 63

Posted: Sun Apr 22, 2012 11:35 am 
Because your basic numbers are integers, the results are integers, including any interim steps. As a result, any number less than 1 will be zero, and prec2 ends up being (0)*100, for the zero result.
If you want to stick with integers, you can do (@prec1*100)/@attempts, which will give you a nonzero result (for any amount <= 1%, anyway).
Also, your percentage of successes would just be (@mortal*100)/@attempts. The other is the percentage of failures.
Mike 



shalimar GURU
Joined: 04 Aug 2002 Posts: 3799 Location: Pensacola, FL, USA

Posted: Sun Apr 22, 2012 5:00 pm 
The #MATH command is not the best method anymore.
It is only retained for backwards compatibility.
prec1=(@attempts@mortal)
prec2=(@mortal*100.0/@attempts )
That should be all you need, the parser knows the proper order of math, and by using a %float number in the first step of the equation, the results will be float. 

_________________ Windows 10 Home Premium 64bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34 






You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum

