percentage code
Posted: Mon May 29, 2006 2:51 am
looking for the best way to return percentages in bc 5.01 for wg3 modules.
i know for a fact from school the formula is:
(currentvalue) / (maxvalue) * 100
but im having a hell of a time, i think cause when ya do the first division statement it breaks it down into decimal
ie: 25/100 comes out tio 0.25
basically i got a mud i been coding on for over a year and i want to return statements where if i look at a monster as someone holding the sysop key after the monster description i want to add a line for vitality info..
ie:
blah blah
Vitality: 25/100 [25%]
i made several functions all return 0's cause of the floating point i do believe but who knows thats why im asking.
sean ferrell had a percnt function in ta1 but it was embedded in the core a snippet of that code would be awesome.
i know for a fact from school the formula is:
(currentvalue) / (maxvalue) * 100
but im having a hell of a time, i think cause when ya do the first division statement it breaks it down into decimal
ie: 25/100 comes out tio 0.25
basically i got a mud i been coding on for over a year and i want to return statements where if i look at a monster as someone holding the sysop key after the monster description i want to add a line for vitality info..
ie:
blah blah
Vitality: 25/100 [25%]
i made several functions all return 0's cause of the floating point i do believe but who knows thats why im asking.
sean ferrell had a percnt function in ta1 but it was embedded in the core a snippet of that code would be awesome.