Advertisement
Guest User

startup.lua

a guest
Jun 17th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local function centerText(monitor, text, left)
  2. local x,y = monitor.getSize()
  3. local x2,y2 = monitor.getCursorPos()
  4. local fractionalXPos = x / 2 - (text:len() / 2)
  5. local newXPos = 0
  6. if(left) then
  7. newXPos = math.ceil(fractionalXPos)
  8. else
  9. newXPos = math.floor(fractionalXPos)
  10. newXPos = newXPos + 1
  11. end
  12.  
  13. monitor.setCursorPos(newXPos, y2)
  14. monitor.write(text)
  15. end
  16.  
  17. monitor = peripheral.wrap("right")
  18. monitor.clear()
  19. monitor.setCursorPos(1,1)
  20. monitor.setTextScale(5)
  21. centerText(monitor, "Maelstrom", true)
  22. monitor.setCursorPos(1,2)
  23. centerText(monitor, "Research", false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement