guusvanwalstijn

Untitled

Nov 12th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 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.  
  29. monitor.setBackgroundColour((colours.lime))
  30. monitor.clear()
  31. monitor.setCursorPos(20,5)
  32.  
  33. monitor.write(" 1. No griefing ")
  34. monitor.setCursorPos(20,8)
  35. monitor.write(" 2. No duplication/glitch/exploits ")
  36. monitor.setCursorPos(20,11)
  37. monitor.write(" 3. Be nice, no offensive language ")
  38. monitor.setCursorPos(20,14)
  39. monitor.write(" 4. Other standard rules ")
  40. monitor.setCursorPos(20,20)
  41. monitor.write(" Go back ")
  42.  
  43.  
  44. if mouseWidth > 15 and mouseWidth < 25 and mouseHeight == 20 then
  45. shell.run("menu")
  46. end
  47. end
  48.  
  49. function staff()
  50. print("staff")
  51. end
  52.  
  53.  
  54. function checkClickPosition()
  55. if mouseWidth > 15 and mouseWidth < 25 and mouseHeight == 5 then
  56.  
  57. rules()
  58.  
  59. elseif mouseWidth > 15 and mouseWidth < 25 and mouseHeight == 10 then
  60.  
  61. staff()
  62.  
  63. end
  64. end
  65.  
  66.  
  67. repeat
  68.  
  69.  
  70. event,p1,p2,p3 = os.pullEvent()
  71.  
  72.  
  73. if event=="monitor_touch" then
  74.  
  75.  
  76. mouseWidth = p2 -- sets mouseWidth
  77. mouseHeight = p3 -- and mouseHeight
  78. checkClickPosition() -- this runs our function
  79.  
  80. end
  81.  
  82. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment