Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
KurtDH
Beginner


Joined: 14 Sep 2004
Posts: 17

PostPosted: Tue Nov 09, 2004 1:08 am   

Decimal points
 
This is the simple setup I have right now:

I have a trigger that counts the number of attacks I perform.

I have a trigger that counts the total damage I've done.

I have a trigger that divides total number of attacks into the damage, in order to find out the average damage per attack.

Is there anyway to show what this number is, in decimal form? I have the number being sent to a status window right now, but it's only showing me 4, 5, 6, etc. I would like to see 4.3, 4.4, 4.5, etc. Is this possible?
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Tue Nov 09, 2004 11:33 am   
 
Hi,

You can get decimal places by using the %float function. You can combine this with %format function to specify how many decimal places you want.

Somthing like

#MATH average %format(2,%eval(%float(@totaldamage)/(@attacks)))

This will give you 2 decimal places.
Reply with quote
KurtDH
Beginner


Joined: 14 Sep 2004
Posts: 17

PostPosted: Tue Nov 09, 2004 8:30 pm   
 
I used that trigger. When totaldamage equaled 332, and attacks equaled 48, the number it was showing me was 6.00 instead of 6.91. What am I doing wrong?
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Tue Nov 09, 2004 9:33 pm   
 
I just tested the above statement

#show %format(2,%eval(%float(332)/(48)))

and then with variables

#math testaverage %format(2,%eval(%float(@totaldamage)/(@attacks)))

I got 6.92 each time.

Might be an idea to recheck the trigger you have that works out the average.
Reply with quote
KurtDH
Beginner


Joined: 14 Sep 2004
Posts: 17

PostPosted: Tue Nov 09, 2004 9:39 pm   
 
Indeed, a missing (.

Thanks.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net