Time based Leaderboard - how to display as 00:00:00 (M:S:MS)

Get help using Construct 2

Post » Thu Jul 07, 2016 12:36 pm

Hello,

I have time based Leaderboards in my game.
I count the time by adding dt every tick and my timer looks like something like this: 19.975983000000404

From Google Play guidelines:
Time leaderboards present scores in hours / minutes / seconds / hundredths of a second format. You must submit scores as milliseconds, so 66032 would be interpreted as 1:06.03.

So I use round(timer*1000) to have 19977 - wich works fine (gives 19.98 in the leaderboard)

But I'm wondering how can I display 19977 as 00:19:98 (M:S:MS) in my game ?

i've found this formula:
zeropad(floor(timer/60),2) & ":" & zeropad(floor(timer)%60,2) & ":" & zeropad(round(timer*100)%100,2)
but it needs modifications to works with round(timer*1000) and since i'm not friendly with Math it's hard for me to figure out .. Anyone know how to modify it accordingly ?
Thank you if you can help !
Last edited by johnsmith on Fri Jul 08, 2016 11:40 am, edited 1 time in total.
Lunar Mission for Android & iOS
B
16
S
2
Posts: 44
Reputation: 1,365

Post » Fri Jul 08, 2016 11:24 am

Sorry to bump, but anyone ?


EDIT: I think I got it working thanks to R0J0hound
(int(t / 60000) % 60) & ":" & (int(t / 1000) % 60) & ":" & (t % 1000)

Only problem is that it gives 3 digits for MS but I've fixed it with my awesome skills of reducing the text size :)
Lunar Mission for Android & iOS
B
16
S
2
Posts: 44
Reputation: 1,365


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 2 guests