Advertisement
GladdeSnaak

test

Feb 2nd, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. mon = peripheral.find("monitor")
  2. local Xpos = 5
  3. local Ypos = 5
  4. local Xend = 30
  5. local Yend = 8
  6. local Yfill = 0
  7.  
  8. function fill(text)
  9. mon.setBackgroundColor(colors.blue)
  10. local yspot = math.floor((Ypos+Yend)/2)
  11. local xspot = math.floor((Xend-Xpos-string.len(text))/2)+1
  12. for j = Ypos,Yend do
  13. mon.setCursorPos(Xpos, j)
  14. if j == yspot then
  15. local xspot2 = math.floor((Xend-Xpos-string.len(text))/2)+1
  16. for k = 0, xspot2 do
  17. if k == xspot then
  18. mon.write(text)
  19. else
  20. mon.write(" ")
  21. end
  22. end
  23. else
  24. for i = Xpos, Xend do
  25. mon.write(" ")
  26. end
  27. end
  28. end
  29. mon.setBackgroundColor(colors.black)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement