|
| 31 Oct 2014 02:50 PM |
I had one in one of my old places, couldn't find it stored on my computer and the old place is on a deleted account.
Basically what I want is a simple timer that coverts the generic '60' to '1:00'
Hibachi Man makes his daring escape, The Barbecue Belly Slide! |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 31 Oct 2014 02:55 PM |
minutes = 0 seconds = 55 while true do wait(1) seconds = seconds + 1 if seconds >= 60 then minutes = minutes + 1 seconds = 0 end print(minutes..":"..seconds) end
you could also use modulus on the seconds to get the minutes but it's probably just easier to do it this way. |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2014 02:57 PM |
want it in a for loop, thanks anyway.
Hibachi Man makes his daring escape, The Barbecue Belly Slide! |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 31 Oct 2014 02:59 PM |
that's a good time to use modulus then I think for i = 55, 120 do print((i%60)..math.floor(i/60)) end
try that |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2014 03:01 PM |
local seconds = 60 local minutes = math.floor(seconds/60)
Yes. It's that easy. lol
~The herp lerped a derp~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 31 Oct 2014 03:01 PM |
Switched them up :P for i = 55, 120 do wait(1) print(math.floor(i/60).." "..(i%60)) end |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2014 03:05 PM |
when it get's to a point where it's supposed to be 1:00, it's 1:0
Hibachi Man makes his daring escape, The Barbecue Belly Slide! |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 31 Oct 2014 03:07 PM |
then add an if statement if i % 60 < 10 print with extra 0 else print reg |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 31 Oct 2014 03:30 PM |
local function FormatSecondsToTime(s) local minutes = math.floor(s/60) local sec = s%60 return (minutes > 9 and minutes or '0'..minutes)..':'..(sec < 10 and '0'..sec or sec) end |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 31 Oct 2014 03:43 PM |
FormatTime = function(time) return ("%2i:%.2i"):format((time/60)%60, time%60) end
for i = 60, 0, -1 do wait(1) print(FormatTime(i)) end
|
|
|
| Report Abuse |
|
|