EnderReaper64

Mega Monitor (Computercraft) (Won't work for you because I made it specifically for my world)

Dec 6th, 2021 (edited)
1,041
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Computercraft Monitor --
  2. local monitor = peripheral.wrap("top")
  3. term.redirect(monitor)
  4. monitor.setCursorPos(1, 1)
  5. monitor.setBackgroundColor(colors.black)
  6. monitor.clear()
  7. local monitorx, monitory = monitor.getSize()
  8.  
  9. function WriteCenter(Text, ypos)
  10.     local curx, cury = monitor.getCursorPos()
  11.     monitor.setCursorPos(math.floor((monitorx/2)+0.5) - math.floor((string.len(Text)/2)+0.5), ypos)
  12.     monitor.write(Text)
  13. end
  14.  
  15. function GetCenter(Text)
  16.     return (math.floor((monitorx/2)+0.5) - math.floor((string.len(Text)/2)+0.5))
  17. end
  18.  
  19. while true do
  20.     monitor.setBackgroundColor(colors.black)
  21.     monitor.clear()
  22.  
  23.     paintutils.drawFilledBox(1, 1, monitorx, 1, colors.red)
  24.     WriteCenter("Ender OS", 1)
  25.  
  26.     local time = os.time()
  27.     local formattedTime = textutils.formatTime(time, false)
  28.  
  29.     monitor.setCursorPos(1, 1)
  30.     monitor.write(formattedTime)
  31.     os.sleep(0.1)
  32. end
RAW Paste Data