Advertisement
Guest User

billboard

a guest
Feb 29th, 2020
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. function centerText(text, y, color)
  2.     -- mon.clear()
  3.         mX = mon.getSize()
  4.         x =  math.floor(mX/2) - math.floor(string.len(text)/2)
  5.         mon.setCursorPos(x, y)
  6.         mon.setTextColor(color)
  7.         mon.write(text)
  8. end
  9.          
  10. mon = peripheral.wrap("right")
  11. mon.clear()
  12. local lines = {}
  13. mon.setTextScale(0.75)
  14. mon.setBackgroundColor(colors.red)
  15. billboardFile = fs.open("billboard.txt", "r")
  16. i = 1
  17. text = billboardFile.readLine()
  18.     repeat
  19.         centerText(text,i,1)
  20.         i = i + 1
  21.         text = billboardFile.readLine()
  22.     until text == nil
  23. billboardFile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement