### Numbers with more than 9 digits.

#### SuperLuigi

• Posts: 13
Hi. I'm really new to Stencyl and coding in general. I am playing with a game that has very large numbers and when I get to a 10 digit number the number will start going negative for a bit then back to positive. Is there a way to have a number that's 20 digist long? eg 20,000,000,000,000,000,000.

#### SuperLuigi

• Posts: 13
Bumping this thread, if that works. Really after an answer to this.

#### sdieters

• Posts: 2068
i think you are getting an e-*something* value. is the font you are using to draw that number set to only draw numbers? if so, set it to all characters, and see if you get an E- aswell
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

#### Rares

• Posts: 216
You could use 2 or more attributes to form the entire number you need Attribute 1 ... Attribute n

You start from Attribute n and see if it's bigger than 99.999.999 (8 digits). If it becomes 100.000.000 increment Attribute n-1 by 1. Then again for Attribute n-1 do the same thing, if it becomes bigger than 99.999.999, increment Attribute n-2 by 1.
Last version (0.1.5) of my now cancelled game:
http://www.stencyl.com/game/play/27241

#### Rares

• Posts: 216
Also you would have to know how many digits you have so you know when to move the score so it fits nicely.
Last version (0.1.5) of my now cancelled game:
http://www.stencyl.com/game/play/27241

• Posts: 1795
Hi. I'm really new to Stencyl and coding in general.

And it doesn't seem strange that you need a 20 digits number? I'd suggest looking at the design of your game and see how you can make the score with less digits instead of trying to find ways to get around that problem.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

#### SuperLuigi

• Posts: 13
And it doesn't seem strange that you need a 20 digits number? I'd suggest looking at the design of your game and see how you can make the score with less digits instead of trying to find ways to get around that problem.

The game starts at 1 and goes to over 20,000,000,000 in a matter of hours. It's an exponential game. Yes I could change the formulas, but it seems shitty that Stencyl can't solve this problem for me. If I put a number in the game regardless of the length, it should be able to use that number.

#### SuperLuigi

• Posts: 13
You could use 2 or more attributes to form the entire number you need Attribute 1 ... Attribute n

You start from Attribute n and see if it's bigger than 99.999.999 (8 digits). If it becomes 100.000.000 increment Attribute n-1 by 1. Then again for Attribute n-1 do the same thing, if it becomes bigger than 99.999.999, increment Attribute n-2 by 1.

So if I have n as 680578, n1 as 100,000,000 and n2 as 3 then I would need to be able to display  n2*n1*100,000,000 + n, is that right? How would I do that in the text field?

The font I'm using has all letters and numbers.

#### Rares

• Posts: 216
Seems to me that you're trying to make a "Make it rain" type of game, where you accumulate cash over time? Anyway, you can do it easier this way

1.000 = 1 K
1.000.000 = 1 M
1.000.000.000 = 1 B
1.000.000.000.000 = 1 T
1.000.000.000.000.000.000 = 1 Quint
1.000.000.000.000.000.000.000 = 1 Sext
..................................... (http://en.wikipedia.org/wiki/Long_and_short_scales) for more

Then it is easy. Just convert when it gets bigger than 1000 to 1, then up the scale to the next one (make a list for it maybe).
If it gets smaller than 1, turn the scale down. Easy.
Last version (0.1.5) of my now cancelled game:
http://www.stencyl.com/game/play/27241

• Posts: 1795
Without some strange workaround he can't physically work with more than 16 digits, as that's the maximum number that can be stored inside a Number attribute (the maximum number that fits inside a Number attribute is 9,007,199,254,740,992 according to this Adobe Help Page)
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

#### Rares

• Posts: 216
He can either try my strange workaround, which is heck a strange even for my standards... and we got the easier workaround posted above.
Last version (0.1.5) of my now cancelled game:
http://www.stencyl.com/game/play/27241

#### rob1221

• Posts: 9472
The game starts at 1 and goes to over 20,000,000,000 in a matter of hours. It's an exponential game. Yes I could change the formulas, but it seems shitty that Stencyl can't solve this problem for me. If I put a number in the game regardless of the length, it should be able to use that number.
It's a Haxe limitation (as well as most programming languages), so it's unfair to blame Stencyl for your problem.  For very large numbers you'll have to break them up using separate numbers (if you want to maintain accuracy), which may be what Rares is talking about.  Lets say you decide to split your numbers every 9 digits.  So anything under a billion would be represented by one number.  For numbers between 10 and 18 digits, you can represent them using two separate numbers.  Then combine them into text that is displayed on the screen.

#### SuperLuigi

• Posts: 13
Awesome thanks all I should be able to get a bit going off of this.