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
Malleus
Novice


Joined: 05 Jan 2003
Posts: 45
Location: USA

PostPosted: Thu Feb 20, 2003 9:28 pm   

Simple Math Equation
 
Im trying to write a simple table in an alias to show my attack statistics. I have something like this in alias 'attacks'

#SHOW Hard Hits:
#MATH testvar (@hitshard/@attacked)*100
#SHOW @testvar

I type the alias and it shows '0' all the time...i even switched the equation up a bit and it always shows '0'. (my variables arent 0 btw :) ) ...Any tips?

/ Malleus /
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Feb 20, 2003 9:44 pm   
 
The issue is integer vs floating point(real numbers) math.
With integer math the result of a small number divided by a large
number yields always 0.

As you are looking for a general percentage do:

#MATH testvar (@hitshard*100/@attacked)


Ton Diening
Reply with quote
Malleus
Novice


Joined: 05 Jan 2003
Posts: 45
Location: USA

PostPosted: Fri Feb 21, 2003 5:48 am   
 
awesome, works....thanks alot :)

/ Malleus /
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