How do I display int variable 1 000 000 as 1 Million?

Get help using Construct 2

» Sat Dec 13, 2014 2:39 pm

Im trying to figure out how I can make av variable, linked to a text object, 1000000 display as 1 million, or even 30000000 display as 30 Million.

Any ideas?
B
3
Posts: 4
Reputation: 185

» Sat Dec 13, 2014 3:32 pm

we will call the number Quantity

to display quantity as millions, we can do:

set text to: int(Quantity/(10^6)) &" Millions"

if quantity is 39 673 829 , it will display as 39 Millions
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

» Sat Dec 13, 2014 5:48 pm

Aphrodite wrote:we will call the number Quantity

to display quantity as millions, we can do:

set text to: int(Quantity/(10^6)) &" Millions"

if quantity is 39 673 829 , it will display as 39 Millions

Perfect!

And do you have an idea how I could add commas to my int variables? Say 153000 is displayed as 153.000 instead?
B
3
Posts: 4
Reputation: 185

» Sat Dec 13, 2014 5:57 pm

Wait, thats wrong. Im confusing myself.

What I need is 1500 to be displayed as 1 500.
150000 = 150 000
1500000 = 1.5 Million
1500000000 = 1.5 Billion

Thx
B
3
Posts: 4
Reputation: 185