Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 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.  
  16.  
  17. monitor.setCursorPos(4,3)
  18. monitor.write(" ON ")
  19. monitor.setBackgroundColor((colors.lime))
  20.  
  21. monitor.setCursorPos(15,3)
  22. monitor.write(" ON ")
  23. monitor.setBackgroundColor((colors.lime))
  24.  
  25. monitor.setCursorPos(24,3)
  26. monitor.write(" ON ")
  27. monitor.setBackgroundColor((colors.lime))
  28.  
  29. monitor.setCursorPos(33,3)
  30. monitor.write(" ON ")
  31. monitor.setBackgroundColor((colors.lime))
  32.  
  33.  
  34.  
  35. monitor.setCursorPos(4,9)
  36. monitor.write(" ON ")
  37. monitor.setBackgroundColor((colors.lime))
  38.  
  39. monitor.setCursorPos(15,9)
  40. monitor.write(" ON ")
  41. monitor.setBackgroundColor((colors.lime))
  42.  
  43. monitor.setCursorPos(24,9)
  44. monitor.write(" ON ")
  45. monitor.setBackgroundColor((colors.lime))
  46.  
  47. monitor.setCursorPos(33,9)
  48. monitor.write(" ON ")
  49. monitor.setBackgroundColor((colors.lime))
  50.  
  51.  
  52.  
  53. monitor.setCursorPos(4,15)
  54. monitor.write(" ON ")
  55. monitor.setBackgroundColor((colors.lime))
  56.  
  57. monitor.setCursorPos(15,15)
  58. monitor.write(" ON ")
  59. monitor.setBackgroundColor((colors.lime))
  60.  
  61. monitor.setCursorPos(24,15)
  62. monitor.write(" ON ")
  63. monitor.setBackgroundColor((colors.lime))
  64.  
  65. monitor.setCursorPos(33,15)
  66. monitor.write(" ON ")
  67. monitor.setBackgroundColor((colors.lime))
  68.  
  69.  
  70.  
  71. monitor.setCursorPos(4,21)
  72. monitor.write(" ON ")
  73. monitor.setBackgroundColor((colors.lime))
  74.  
  75. monitor.setCursorPos(15,21)
  76. monitor.write(" ON ")
  77. monitor.setBackgroundColor((colors.lime))
  78.  
  79. monitor.setCursorPos(24,21)
  80. monitor.write(" ON ")
  81. monitor.setBackgroundColor((colors.lime))
  82.  
  83. monitor.setCursorPos(33,21)
  84. monitor.write(" ON ")
  85. monitor.setBackgroundColor((colors.lime))
  86.  
  87.  
  88.  
  89. function checkClickPosition()
  90. if mouseWidth > 4 and mouseWidth < 10 and mouseHeight == 3 then
  91.  
  92. elseif mouseWidth > 14 and mouseWidth < 20 and mouseHeight == 3 then
  93.  
  94. elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 3 then
  95.  
  96. elseif mouseWidth > 32 and mouseWidth < 38 and mouseHeight == 3 then
  97.  
  98. elseif mouseWidth > 4 and mouseWidth < 10 and mouseHeight == 9 then
  99.  
  100. elseif mouseWidth > 14 and mouseWidth < 20 and mouseHeight == 9 then
  101.  
  102. elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 9 then
  103.  
  104. elseif mouseWidth > 32 and mouseWidth < 38 and mouseHeight == 9 then
  105.  
  106. elseif mouseWidth > 4 and mouseWidth < 10 and mouseHeight == 15 then
  107.  
  108. elseif mouseWidth > 14 and mouseWidth < 20 and mouseHeight == 15 then
  109.  
  110. elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 15 then
  111.  
  112. elseif mouseWidth > 32 and mouseWidth < 38 and mouseHeight == 15 then
  113.  
  114. elseif mouseWidth > 4 and mouseWidth < 10 and mouseHeight == 21 then
  115.  
  116. elseif mouseWidth > 14 and mouseWidth < 20 and mouseHeight == 21 then
  117.  
  118. elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 21 then
  119.  
  120. elseif mouseWidth > 32 and mouseWidth < 38 and mouseHeight == 21 then
  121.  
  122.  
  123. end
  124. end
  125.  
  126. repeat
  127. event,p1,p2,p3 = os.pullEvent()
  128.  
  129.  
  130. if event=="monitor_touch" then
  131.  
  132. mouseWidth = p2
  133. mouseHeight = p3
  134. checkClickPosition()
  135.  
  136. end
  137.  
  138. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement