Score over 1 000 000
by Chris Cockcroft · in Torque Game Builder · 04/08/2005 (10:19 am) · 7 replies
Initially in my game, the score system was set up to allow for pretty high scores right off the bat. I think that kind of thing worked well for pinball games, so why not for other genres? :)
The problem I'm having though, is that once $player.score goes over a million, it's converted to read like this
This really messes up how the score gets displayed on screen. What I've done is adjusted the scoring system so that the player would have to play for a VERY long time before reaching 1000000. But this is (obviously) a pretty crappy way of handling the issue :P
So my question is, is there a way to make it stick to standard numeral notation? Or maybe an easy way to convert my score string to show the right notation?
Any help is appreciated,
Thanks!
Chris
The problem I'm having though, is that once $player.score goes over a million, it's converted to read like this
1.504e+06
This really messes up how the score gets displayed on screen. What I've done is adjusted the scoring system so that the player would have to play for a VERY long time before reaching 1000000. But this is (obviously) a pretty crappy way of handling the issue :P
So my question is, is there a way to make it stick to standard numeral notation? Or maybe an easy way to convert my score string to show the right notation?
Any help is appreciated,
Thanks!
Chris
About the author
#2
You could always break the score up into units then concatenate them for display.
04/08/2005 (10:21 am)
Sorry. That wasn't productive :pYou could always break the score up into units then concatenate them for display.
#3
04/08/2005 (10:25 am)
Use mCeil() or mFloor()
#4
Thanks Matthew - you are indeed the king :)
04/08/2005 (10:58 am)
@John - High scores are cool :P And the problem with my game is that it in theory never ends, so a really good player could surpass a million no matter what. Thanks Matthew - you are indeed the king :)
#6
Subtract the truncated result from the decimal result.
Multiply difference by 10 to get a value from 0-9. This is your leftmost digit.
Continue until the truncated value is zero.
Now you have the number to display.
04/09/2005 (4:53 am)
Divide the score by ten.Subtract the truncated result from the decimal result.
Multiply difference by 10 to get a value from 0-9. This is your leftmost digit.
Continue until the truncated value is zero.
Now you have the number to display.
#7
04/09/2005 (5:31 am)
Thanks, Bucko. I was thinking I was going to have to do something like that, but then, Matthew's method is just a bit simpler ;)$player.score = mCeil( $player.score );
Torque Owner John Vanderbeck
VanderGames