[SOLVED]How do I show leading zeroes in score?

Get help using Construct 2

Post » Thu Sep 10, 2015 12:22 pm

I want to put a score counter on the screen with pre-displayed digits. For example, if the player has 100 points, I want it to show '0000100' or something like that. Is there any way to make a score variable's contents display that way?
Last edited by Dualmask on Thu Sep 10, 2015 12:27 pm, edited 1 time in total.
B
10
S
2
Posts: 32
Reputation: 761

Post » Thu Sep 10, 2015 12:24 pm

From the manual:
https://www.scirra.com/manual/126/system-expressions

zeropad(number, digits)
Pad number out to a certain number of digits by adding zeroes in front of the number, then returning the result as a string. For example, zeropad(45, 5) returns the string "00045".
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 10, 2015 12:26 pm

Thanks, that worked perfectly. Read most of the manual but that was one entry I skipped. Going to study it now.
B
10
S
2
Posts: 32
Reputation: 761


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests