Advertisement
Tofeurdu54

test

Apr 6th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. t = term.setTextColor
  2.  
  3. local monitor = peripheral.find("monitor")
  4. local timer = os.startTimer(1)
  5. term.redirect(monitor)
  6.  
  7. local p ={
  8. p ="Temps depuis le redemarrage du serveur."
  9. }
  10.  
  11. function clear()
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. end
  15.  
  16. function clock()
  17.  
  18. local secondes = 0
  19. local minutes = 0
  20. local heures = 0
  21. while true do
  22. shell.run("clear")
  23. t(colors.red)
  24. print(heures,"h", ":", minutes,"m", ":", secondes,"s")
  25. t(colors.green)
  26. print(p.p)
  27. local event,timerId = os.pullEvent("timer")
  28. if timerId == timer then
  29.  
  30. print(secondes)
  31. secondes = secondes + 1
  32. if secondes == 60 then
  33. minutes = minutes + 1
  34. secondes = 0
  35. end
  36.  
  37. if minutes == 60 then
  38. heures = heures + 1
  39. minutes = 0
  40. secondes = 0
  41. end
  42.  
  43. timer = os.startTimer(1)
  44. end
  45. end
  46. end
  47. clear()
  48. clock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement