How do I add Letter M when number reaches million

Get help using Construct 2

Post » Thu Oct 20, 2016 1:46 pm

SORRY FOR BAD ENLISH

How do I add a M B T
At the end of a Large number so it doesn't display too many 000000s
B
6
Posts: 23
Reputation: 304

Post » Thu Oct 20, 2016 2:00 pm

len(yourtext)=9=m
len(yourtext)=12=b
len(yourtext)=16=t
Image ImageImage
B
170
S
50
G
179
Posts: 8,378
Reputation: 113,425

Post » Thu Oct 20, 2016 2:03 pm

Maybe something like:

score >= 1000000000000
-> displayText = int(score/1000000000000) & "T"
else score >= 1000000000
-> displayText = int(score/1000000000) & "B"
else score >= 1000000
-> displayText = int(score/1000000) & "M"
else
-> displayText = score
Find all the Construct 2 games that were on Steam Greenlight here
B
35
S
9
G
7
Posts: 467
Reputation: 6,864

Post » Thu Oct 20, 2016 3:02 pm

Thanks everyone appreciate it
B
6
Posts: 23
Reputation: 304

Post » Sun Jan 08, 2017 9:41 pm

Sorry for ressurecting this thread. I followed OddConfection instructions and managed to display the numbers how i wanted them as well except for the numbers between 1Million and 10 Million.
I would like to be able to display for example 1 million and 200 thousand as 1.2 M until it reaches 10 million, but i don´t seem to able to do that.
Would anyone be kind enough to teach me?
Thanks in advance.
B
26
S
14
G
8
Posts: 49
Reputation: 6,250

Post » Tue Jan 10, 2017 6:14 pm

@Husui

I've added in something so values over 10M are treated the same as before, but values between 1M and 10M are rounded to 1 decimal place.

score >= 1000000000000
-> displayText = int(score/1000000000000) & "T"
else score >= 1000000000
-> displayText = int(score/1000000000) & "B"
else score >= 10000000
-> displayText = int(score/1000000) & "M"
else score >= 1000000
-> displayText = int(score/100000)/10 & "M"
else
-> displayText = score
Find all the Construct 2 games that were on Steam Greenlight here
B
35
S
9
G
7
Posts: 467
Reputation: 6,864

Post » Tue Jan 10, 2017 9:00 pm

@OddConfection

Damn, thanks alot for your help now im one step closer to making my game come true.
Thanks a million.
B
26
S
14
G
8
Posts: 49
Reputation: 6,250


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 12 guests