MegiRicky

montiorClock.lua

Aug 13th, 2026
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. -- Display the current Minecraft in-game time on the first attached monitor.
  2.  
  3. local monitor = peripheral.find("monitor")
  4. if not monitor then
  5. error("No monitor attached")
  6. end
  7.  
  8. monitor.setTextScale(1)
  9.  
  10. while true do
  11. local width, height = monitor.getSize()
  12. local message = "Time: " .. textutils.formatTime(os.time(), true)
  13.  
  14. monitor.clear()
  15. monitor.setCursorPos(
  16. math.max(1, math.floor((width - #message) / 2) + 1),
  17. math.max(1, math.floor(height / 2))
  18. )
  19. monitor.write(message)
  20.  
  21. print("Current time: "..os.time())
  22.  
  23. sleep(0.5)
  24. end
  25.  
Advertisement
Add Comment
Please, Sign In to add comment