DooMAGE Posted August 2, 2016 Share Posted August 2, 2016 Hello guys! I am working on a hud stopwatch timer thing for my game, but looks like I can't use os.date("%X",0) from Lua since I guess you can't upload games with sandbox Lua off to the game launcher :/ Having a little trouble to format my Time:GetSpeed()/100 to something like MM:SS:MI Thanks in advance 1 Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
thehankinator Posted August 2, 2016 Share Posted August 2, 2016 Hello guys! I am working on a hud stopwatch timer thing for my game, but looks like I can't use os.date("%X",0) from Lua since I guess you can't upload games with sandbox Lua off to the game launcher :/ Having a little trouble to format my Time:GetSpeed()/100 to something like MM:SS:MI Thanks in advance Time:GetCurrent() is in MS. I'd do it something like below. StartTime would need to be initialized to whatever time the timer starts with Time:GetCurrent() local MS = Time:GetCurrent() - StartTime local Minutes = math.floor(MS / 60000) MS = MS - Minutes * 60000 local Seconds = math.floor(MS / 1000) MS = MS - Seconds * 1000 local TimeStamp = Minutes..":"..Seconds..":"..MS 1 Quote Link to comment Share on other sites More sharing options...
DooMAGE Posted August 2, 2016 Author Share Posted August 2, 2016 Thanks thehankinator, now I can show the timer on the screen But I am having a hard time to reset the stopwatch. Tried force MS = 0 using a If, but when the if is no more true the timer resumes and keeps going up. Maybe I need some beer 1 Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
thehankinator Posted August 2, 2016 Share Posted August 2, 2016 Thanks thehankinator, now I can show the timer on the screen But I am having a hard time to reset the stopwatch. Tried force MS = 0 using a If, but when the if is no more true the timer resumes and keeps going up. Maybe I need some beer Beer helps but to to reset the timer just reinitialize StartTime with Time:GetCurrent() 1 Quote Link to comment Share on other sites More sharing options...
DooMAGE Posted August 2, 2016 Author Share Posted August 2, 2016 Beer helps but to to reset the timer just reinitialize StartTime with Time:GetCurrent() Thank you very much Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.