guusvanwalstijn

Untitled

Nov 12th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. mouseWidth = 0
  2. mouseHeight = 0
  3.  
  4. monitor = peripheral.wrap("top")
  5.  
  6. monitor.clear()
  7.  
  8. monitor.setCursorPos(1,1)
  9.  
  10. w,h=monitor.getSize()
  11.  
  12. print(w)
  13. print(h)
  14.  
  15. monitor.setBackgroundColour((colours.lime))
  16.  
  17. monitor.setCursorPos(20,5)
  18.  
  19. monitor.write(" RULES ")
  20.  
  21. monitor.setCursorPos(20,10)
  22.  
  23. monitor.write(" STAFF ")
  24.  
  25. monitor.setBackgroundColour((colours.black))
  26.  
  27. function rules()
  28. print("rules")
  29. end
  30.  
  31. function staff()
  32. print("staff")
  33. end
  34.  
  35.  
  36. function checkClickPosition()
  37. if mouseWidth > 15 and mouseWidth < 25 and mouseHeight == 5 then
  38.  
  39. rules()
  40.  
  41. elseif mouseWidth > 15 and mouseWidth < 25 and mouseHeight == 10 then
  42.  
  43. staff()
  44.  
  45. end
  46. end
  47.  
  48.  
  49. repeat
  50.  
  51.  
  52. event,p1,p2,p3 = os.pullEvent()
  53.  
  54.  
  55. if event=="monitor_touch" then
  56.  
  57.  
  58. mouseWidth = p2 -- sets mouseWidth
  59. mouseHeight = p3 -- and mouseHeight
  60. checkClickPosition() -- this runs our function
  61.  
  62. end
  63.  
  64. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment