# How do I Show 10.000 as 10K etc

0 favourites
• 4 posts
• Hi all!

I am creating a game where i use big yet huge numbers.

Even to billions. Ofcourse i can't display: 10.000.000.000.000..

Well.. It's possible but i don't want to.

Is there any way i can display:

1.000 as 1K

50.000 as 50K

1.000.000 as 1M

1.000.000.000 as 1B etc?

That also raises my question, is there in construct 2 a limit for the amount of numbers in a global variable and webstorages?

• Would something like this work?

if variable > 1000 set text: round(variable/1000)&"K"

if variable > 1000000 set text: round(variable/1000000)&"M"

• LittleStain yes it will work, tried it before. Good job for finding the answer!

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• As for the maximum number, I think C2 can really go far, but since it is using floats, the precision might be affected when you go really far into big numbers, I think the maximum UID number is somewhat close to 9 000 000 000 000 000 and I would assume so that the maximum accurate integer value would be around that, but it could be larger (still pretty high anyway)

As for the solution LittleStain suggested, I would recommend doing a function that will format it the way you want, by comparing the number of digits the integer value of the number have.

Edit: also you might want to use the Internation system prefixes if you go really high (k ; M ; G ; T ; P ; E ; Z ; Y)