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
Banzai
Newbie


Joined: 29 May 2003
Posts: 6
Location: USA

PostPosted: Sun Jun 15, 2003 1:36 am   

Dividing vars to get a Percentage
 
I have 2 vars, well actually 3.. @SpellsCast @SpellsSuccess @SpellsFailed

now I want to take these spells to figure out my Percentage of either Success or Failure. When I divide them using @SpellsFailed/@SpellsCast I get 0. Help?

Wherever you go, there you are.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jun 15, 2003 2:40 am   
 
You get zero because the / division operator works only with integers (whole numbers). To get around this, multiply the dividend (@SpellsFailed) by 100 and then do the division.

li'l shmoe of Dragon's Gate MUD
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