MagmaLP

Welcome Screen

May 30th, 2024 (edited)
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. s = sensor.wrap("right")
  3. mon = peripheral.wrap("back")
  4. mon.setBackgroundColor(colors.black)
  5. mon.setTextScale(3)
  6. mon.setCursorPos(1,1)
  7. mon.clear()
  8.  
  9. mon.setTextColor(colors.yellow)
  10.  
  11. shift = 0
  12.  
  13. function centerText(text, line)
  14.     local x, y = mon.getSize()
  15.     mon.setCursorPos(math.ceil((x / 2) - (text:len() / 2)) + shift, line)
  16.     mon.write(text)
  17. end
  18.  
  19. while true do
  20.     mon.clear()
  21.     centerText("Welcome", 2)
  22.    
  23.     for name, info in pairs(s.getTargets()) do
  24.         centerText(name, 3)
  25.     end
  26.    
  27.     shift = shift + 1
  28.    
  29.     sleep(3.5)
  30. end
  31.  
Advertisement
Add Comment
Please, Sign In to add comment