How do I add Letter M when number reaches million

Get help using Construct 2

» Thu Oct 20, 2016 1:46 pm

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
S
1
Posts: 23
Reputation: 454

» Thu Oct 20, 2016 2:00 pm

len(yourtext)=9=m
len(yourtext)=12=b
len(yourtext)=16=t
B
178
S
50
G
206
Posts: 8,685
Reputation: 127,713

» 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
41
S
11
G
7
Posts: 511
Reputation: 7,326

» Thu Oct 20, 2016 3:02 pm

Thanks everyone appreciate it
B
6
S
1
Posts: 23
Reputation: 454

» 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?
B
26
S
14
G
8
Posts: 49
Reputation: 6,250

» 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
41
S
11
G
7
Posts: 511
Reputation: 7,326

» 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