AKopyl

ClockTemplate

Dec 1st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. DIGIT = 1
  2. SEGMENT = 1
  3.  
  4. seg = {}
  5. seg[1] = '23567890'
  6. seg[2] = '456890'
  7. seg[3] = '12347890'
  8. seg[4] = '2345689'
  9. seg[5] = '2680'
  10. seg[6] = '134567890'
  11. seg[7] = '2356890'
  12.  
  13. while true do
  14. if os.time()%1*100*6 >= 99 then
  15. mins = string.sub(tostring(os.time()%1*100*6), 1, 2)
  16. else
  17. mins = '0'..string.sub(tostring(os.time()%1*100*6), 1, 1)
  18. end
  19.  
  20. if os.time() - os.time()%1 > 9 then
  21. hours = tostring(os.time() - os.time()%1)
  22. else
  23. hours = '0'..tostring(os.time() - os.time()%1)
  24. end
  25.  
  26. time = hours .. mins
  27.  
  28. term.setCursorPos(1, 1)
  29. term.clear()
  30. print(os.time())
  31. print(time)
  32.  
  33. if string.match(seg[SEGMENT], string.sub(time, DIGIT, DIGIT)) then
  34. redstone.setOutput('left', true)
  35. else
  36. redstone.setOutput('left', false)
  37. end
  38.  
  39. sleep(1)
  40. end
Add Comment
Please, Sign In to add comment