Kryzeth

outline

Oct 18th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local args = { ... }  --row and col
  2.  
  3. --Set variables
  4. local length = 10
  5. local height = 3
  6. local row  = args[1] or 1
  7. local col = args[2] or 1
  8.  
  9. --Set monitor properties
  10. mon = peripheral.wrap("monitor_1")
  11. mon.setTextScale(0.5)
  12.  
  13. --Calculate position and offset
  14. local posX = (row-1) * length + 1
  15. local posY = (col-1) * height + 1
  16. local offsetX = posX + length - 1
  17.  
  18. --Outline of button
  19. mon.setBackgroundColor(colors.white)
  20. mon.setCursorPos(posX,posY)
  21. mon.write(string.rep(" ", length))
  22.  
  23. mon.setCursorPos(posX,posY+1)
  24. mon.write(" ")
  25. mon.setCursorPos(offsetX,posY+1)
  26. mon.write(" ")
  27.  
  28. mon.setCursorPos(posX,posY+2)
  29. mon.write(string.rep(" ", length))
Add Comment
Please, Sign In to add comment