Advertisement
April_The_Sergal

textForComputercraft

Oct 19th, 2020 (edited)
2,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. attachedMonitor = peripheral.wrap("bottom")
  2. attachedMonitor.setTextScale(2)
  3. attachedMonitor.setBackgroundColor(colors.green)
  4. attachedMonitor.setTextColor(colors.blue)
  5. attachedMonitor.clear()
  6.  
  7. local function centerText(text)
  8.     local x,y = attachedMonitor.getSize()
  9.     local x2,y2 = attachedMonitor.getCursorPos()
  10.     stringCen = math.ceil((x / 2) - (text:len() / 2))
  11.     attachedMonitor.setCursorPos(stringCen + 1, y/2)
  12.     attachedMonitor.write(text)
  13. end
  14. print("Please enter the text you want to write")
  15. local room = read()
  16. centerText(room)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement