Guest User

ticket

a guest
Oct 11th, 2016
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. mouseWidth = 0
  2. mouseHeight = 0
  3. monitor = peripheral.wrap("top")
  4. ticket = peripheral.wrap("back")
  5. monitor.clear()
  6. monitor.setCursorPos(1, 1)
  7. w, h=monitor.getSize()
  8.  
  9. monitor.setBackgroundColor((colors.blue))
  10. monitor.setCursorPos(2, 2)
  11. monitor.setTextColor(colors.white)
  12. monitor.write("  Sandshire  ")
  13. monitor.setCursorPos(2, 4)
  14. monitor.setTextColor(colors.white)
  15. monitor.write("  Spawnbase  ")
  16. monitor.setBackgroundColor(colours.white)
  17.  
  18. function checkClickPosition()
  19.  
  20.  if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
  21.   ticket.createTicket(1,1)
  22.  elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  23.   ticket.createTicket(2,1)
  24.  end
  25.  
  26. end
  27.  
  28. repeat
  29. event ,p1,p2,p3 = os.pullEvent()
  30.  if event=="monitor_touch" then
  31.    mouseWidth = p2
  32.    mouseHeight = p3
  33.    checkClickPosition()
  34.          
  35.  end
  36.      
  37. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment