RobotBubble

ClickRemote1

Nov 3rd, 2017
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local x, y = 14,9
  2. local x2, y2 = 12,10
  3. local x3, y3 = 16,10
  4. local x4, y4 = 14,11
  5. local x5, y5 = 2,15
  6. local x6, y6 = 2,16
  7. local x7, y7 = 2,17
  8. local x8, y8 = 18,15
  9. local x9, y9 = 18,16
  10. local x10, y10 = 18,17
  11. local x11, y11 = 9,13
  12. local x12, y12 = 20,2
  13. local x13, y13 = 24,2
  14. local x14, y14 = 5,6
  15. local x15, y15 = 5,20
  16. local x16, y16 = 7,20
  17. local x17, y17 = 9,20
  18. local x18, y18 = 11,20
  19. local x19, y19 = 13,20
  20. local x21, y21 = 15,20
  21. local x22, y22 = 17,20
  22. local x23, y23 = 19,20
  23. local x24, y24 = 4,9
  24. local x25, y25 = 4,10
  25. local x25, y26 = 2,4
  26. local choice1 = "^"
  27. local choice2 = "<"
  28. local choice3 = ">"
  29. local choice4 = "v"
  30. local choice5 = "[ ]Place"
  31. local choice6 = "[^]Place"
  32. local choice7 = "[v]Place"
  33. local choice8 = "[ ]Dig"
  34. local choice9 = "[^]Dig"
  35. local choice10 = "[v]Dig"
  36. local choice11 = "[x]Attack"
  37. local choice12 = "+ |"
  38. local choice13 = " -"
  39. local choice14 = "[ ]Fuel:"
  40. local choice15 = "|1"
  41. local choice16 = "|2"
  42. local choice17 = "|3"
  43. local choice18 = "|4"
  44. local choice19 = "|5"
  45. local choice20 = "|6"
  46. local choice21 = "|7"
  47. local choice22 = "|8"
  48. local choice23 = "|9|"
  49. local choice24 = "[^]"
  50. local choice25 = "[v]"
  51. local choice26 = "[-]Dig"
  52. local function drawMenu()
  53. term.setCursorPos(x, y)
  54. term.setTextColor(colors.white)
  55. write(choice1)
  56. term.setCursorPos(x2, y2)
  57. write(choice2)
  58. term.setCursorPos(x3, y3)
  59. write(choice3)
  60. term.setCursorPos(x4, y4)
  61. write(choice4)
  62. term.setCursorPos(x5, y5)
  63. write(choice5)
  64. term.setCursorPos(x6, y6)
  65. write(choice6)
  66. term.setCursorPos(x7, y7)
  67. write(choice7)
  68. term.setCursorPos(x8, y8)
  69. write(choice8)
  70. term.setCursorPos(x9, y9)
  71. write(choice9)
  72. term.setCursorPos(x10, y10)
  73. write(choice10)
  74. term.setCursorPos(x11, y11)
  75. write(choice11)
  76. term.setCursorPos(x12, y12)
  77. write(choice12)
  78. term.setCursorPos(x13, y13)
  79. write(choice13)
  80. term.setCursorPos(x14, y14)
  81. write(choice14)
  82. term.setCursorPos(x15, y15)
  83. write(choice15)
  84. term.setCursorPos(x16, y16)
  85. write(choice16)
  86. term.setCursorPos(x17, y17)
  87. write(choice17)
  88. term.setCursorPos(x18, y18)
  89. write(choice18)
  90. term.setCursorPos(x19, y19)
  91. write(choice19)
  92. term.setCursorPos(x20, y20)
  93. write(choice20)
  94. term.setCursorPos(x21, y21)
  95. write(choice21)
  96. term.setCursorPos(x22, y22)
  97. write(choice23)
  98. term.setCursorPos(x23, y23)
  99. write(choice23)
  100. term.setCursorPos(x24, y24)
  101. write(choice24)
  102. term.setCursorPos(x25, y25)
  103. write(choice25)
  104. term.setCursorPos(x26, y26)
  105. write(choice26)
  106. end
  107.  
  108. drawMenu()
  109.  
  110. while true do
  111. local event, button, cx, cy = os.pullEvent()
  112. if event == "mouse_click" then
  113. if cx >= x and cx < choice1:len() and cy == y and button == 1 then
  114. rednet.broadcast("TS Forward")
  115. elseif cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  116. rednet.broadcas("TS TurnLeft")
  117. elseif cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  118. rednet.broadcast("TS TurnRight")
  119. elseif cx >= x4 and cx < choice4:len() and cy == y4 and button == 1 then
  120. rednet.broadcast("TS Back")
  121. elseif cx >= x5 and cx < choice5:len() and cy == y5 and button == 1 then
  122. rednet.broadcast("TS PlaceBlock")
  123. elseif cx >= x6 and cx < choice6:len() and cy == y6 and button == 1 then
  124. rednet.broadcast("TS PlaceUp")
  125. elseif cx >= x7 and cx < choice7:len() and cy == y7 and button == 1 then
  126. rednet.broadcast("TS PlaceDown")
  127. elseif cx >= x8 and cx < choice8:len() and cy == y8 and button == 1 then
  128. rednet.broadcast("TS Dig")
  129. elseif cx >= x9 and cx < choice9:len() and cy == y9 and button == 1 then
  130. rednet.broadcast("TS DigUp")
  131. elseif cx >= x10 and cx < choice10:len() and cy == y10 and button == 1 then
  132. rednet.broadcast("TS DigDown")
  133. elseif cx >= x11 and cx < choice11:len() and cy == y11 and button == 1 then
  134. rednet.broadcast("TS Attack")
  135. elseif cx >= x12 and cx < choice12:len() and cy == y12 and button == 1 then
  136. rednet.broadcast("TS Redstone FWD: On")
  137. elseif cx >= x13 and cx < choice13:len() and cy == y13 and button == 1 then
  138. rednet.broadcast("TS Redstone FWD: Off")
  139. elseif cx >= x14 and cx < choice14:len() and cy == y14 and button == 1 then
  140. rednet.broadcast("TS Refuel")
  141. local scrap, message = rednet.receive()
  142. term.setCursorPos(14, 6)
  143. term.setTextColor(colors.white)
  144. print(message)
  145. elseif cx >= x15 and cx < choice15:len() and cy == y15 and button == 1 then
  146. rednet.broadcast("1")
  147. term.setCursorPos(5, 20)
  148. term.setTextColor(colors.white)
  149. print("|")
  150. term.setCursorPos(6, 20)
  151. term.setTextColor(colors.green)
  152. print("1")
  153. term.setCursorPos(8, 20)
  154. term.setTextColor(colors.white)
  155. print("|2|3|4|5|6|7|8|9|")
  156. elseif cx >= x16 and cx < choice16:len() and cy == y16 and button == 1 then
  157. rednet.broadcast("2")
  158. term.setCursorPos(5, 20)
  159. term.setTextColor(colors.white)
  160. print("|1|")
  161. term.setCursorPos(9, 20)
  162. term.setTextColor(colors.green)
  163. print("2")
  164. term.setCursorPos(11, 20)
  165. term.setTextColor(colors.white)
  166. print("|3|4|5|6|7|8|9|")
  167. elseif cx >= x17 and cx < choice17:len() and cy == y17 and button == 1 then
  168. rednet.broadcast("3")
  169. term.setCursorPos(5, 20)
  170. term.setTextColor(colors.white)
  171. print("|1|2|")
  172. term.setCursorPos(11, 20)
  173. term.setTextColor(colors.green)
  174. print("3")
  175. term.setCursorPos(13, 20)
  176. term.setTextColor(colors.white)
  177. print("|4|5|6|7|8|9|")
  178. elseif cx >= x18 and cx < choice18:len() and cy == y18 and button == 1 then
  179. rednet.broadcast("4")
  180. term.setCursorPos(5, 20)
  181. term.setTextColor(colors.white)
  182. print("|1|2|3|")
  183. term.setCursorPos(13, 20)
  184. term.setTextColor(colors.green)
  185. print("4")
  186. term.setCursorPos(15, 20)
  187. term.setTextColor(colors.white)
  188. print("|5|6|7|8|9|")
  189. elseif cx >= x19 and cx < choice19:len() and cy == y19 and button == 1 then
  190. rednet.broadcast("5")
  191. term.setCursorPos(5, 20)
  192. term.setTextColor(colors.white)
  193. print("|1|2|3|4|")
  194. term.setCursorPos(15, 20)
  195. term.setTextColor(colors.green)
  196. print("5")
  197. term.setCursorPos(17, 20)
  198. term.setTextColor(colors.white)
  199. print("|6|7|8|9|")
  200. elseif cx >= x20 and cx < choice20:len() and cy == y20 and button == 1 then
  201. rednet.broadcast("6")
  202. term.setCursorPos(5, 20)
  203. term.setTextColor(colors.white)
  204. print("|1|2|3|4|5|")
  205. term.setCursorPos(17, 20)
  206. term.setTextColor(colors.green)
  207. print("6")
  208. term.setCursorPos(19, 20)
  209. term.setTextColor(colors.white)
  210. print("|7|8|9|")
  211. elseif cx >= x21 and cx < choice21:len() and cy == y21 and button == 1 then
  212. rednet.broadcast("7")
  213. term.setCursorPos(5, 20)
  214. term.setTextColor(colors.white)
  215. print("|1|2|3|4|5|6|")
  216. term.setCursorPos(19, 20)
  217. term.setTextColor(colors.green)
  218. print("7")
  219. term.setCursorPos(21, 20)
  220. term.setTextColor(colors.white)
  221. print("|8|9|")
  222. elseif cx >= x22 and cx < choice22:len() and cy == y22 and button == 1 then
  223. rednet.broadcast("8")
  224. term.setCursorPos(5, 20)
  225. term.setTextColor(colors.white)
  226. print("|1|2|3|4|5|6|7|")
  227. term.setCursorPos(23, 20)
  228. term.setTextColor(colors.green)
  229. print("8")
  230. term.setCursorPos(25, 20)
  231. term.setTextColor(colors.white)
  232. print("|9|")
  233. elseif cx >= x23 and cx < choice23:len() and cy == y23 and button == 1 then
  234. rednet.broadcast("9")
  235. term.setCursorPos(5, 20)
  236. term.setTextColor(colors.white)
  237. print("|1|2|3|4|5|6|7|8|")
  238. term.setCursorPos(27, 20)
  239. term.setTextColor(colors.green)
  240. print("9")
  241. term.setCursorPos(29, 20)
  242. term.setTextColor(colors.white)
  243. print("|")
  244. elseif cx >= x24 and cx < choice24:len() and cy == y24 and button == 1 then
  245. rednet.broadcast("TS Up")
  246. elseif cx >= x25 and cx < choice25:len() and cy == y25 and button == 1 then
  247. rednet.braodcast("TS Down")
  248. elseif cx >= x26 and cx < choice26:len() and cy == y26 and button == 1 then
  249. shell.run("remote2")
  250. end
  251. end
  252. end
RAW Paste Data Copied