Advertisement
WaffleJohns

Waffles Simple Countdown

Jan 18th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. --WaffleJohns's countdown timer for Tekkit MC
  2.  
  3. --If you want the below values to be entered as you launch the program then try using read() ex: "local h = read()"
  4. local h = 2
  5. local m = 29
  6. local s = 59
  7.  
  8. local total = ((h*60*60)+(m*60)+s) --Counts the total seconds
  9.  
  10. for i = total,0,-1 do
  11.  
  12. s = i%60 --Divides by 60 and gives you the remainder, which happens to be the seconds :)
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. print(h.. ":".. m.. ":".. s)
  16.  
  17. if s == 0 then
  18. m = m-1
  19. end
  20. if m == -1 then
  21. h = h-1
  22. m = 59
  23. end
  24. sleep(1)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement