Advertisement
Guest User

Reciever

a guest
May 5th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.01 KB | None | 0 0
  1. rednet.open("back")
  2. term.clear()
  3. run=1
  4.  
  5. XMin=1
  6. YMin=1
  7.  
  8. YMax=18
  9. XMax=26
  10.  
  11. function Var()
  12. Menu=true
  13. DoorSettings=true                                                                                                                                              
  14. DoorMenu=false
  15.  
  16. DoorAuto=true
  17. DoorManu=false
  18.  
  19. TextColor=colors.white
  20.  
  21. BackColor1=colors.orange
  22. BackColor2=colors.orange
  23.  
  24. IconOnColor=colors.green
  25. IconOffColor=colors.red
  26. IconBack=colors.gray
  27.  
  28. end
  29.  
  30. function Text()
  31.  
  32. YT=0
  33.  
  34. while YT < YMax / 2 do
  35. term.setBackgroundColor(BackColor1)
  36. print("                          ")
  37. term.setBackgroundColor(BackColor2)
  38. print("                          ")
  39. YT = YT + 1
  40. end
  41.  
  42. if Menu == true then
  43.  
  44. term.setCursorPos(2,2)
  45. term.setBackgroundColor(BackColor2)
  46. print("-----  Door     ") --21,22
  47.  
  48. term.setBackgroundColor(IconBack)
  49. term.setCursorPos(19,2)
  50. print("    ")
  51.  
  52. term.setBackgroundColor(colors.cyan)
  53. term.setCursorPos(25,2)
  54. print("x")
  55.    
  56.  
  57. if DoorSettings == false and Menu == true then
  58. --term.setTextColor(colors.gray)
  59. term.setCursorPos(19,2)
  60. term.setBackgroundColor(IconOffColor)
  61. print("Off")
  62.  
  63. end
  64.    
  65. if DoorSettings == true and Menu == true then
  66. term.setBackgroundColor(IconOnColor)
  67. term.setCursorPos(20,2)
  68. print(" On")
  69. end
  70. end
  71.  
  72. if DoorMenu == true and Menu == false then
  73.  
  74. term.setTextColor(colors.white)
  75. term.setBackgroundColor(colors.gray)
  76. term.setCursorPos(6,5)
  77. print("  Door settings ")
  78. term.setBackgroundColor(colors.lightGray)
  79. term.setCursorPos(6,6)
  80. print("                ")
  81. term.setCursorPos(6,7)
  82. print("                ")
  83. term.setCursorPos(6,8)
  84. print("                ")
  85. term.setCursorPos(6,9)
  86. print("                ")
  87. term.setCursorPos(6,10)
  88. print("                ")
  89. term.setCursorPos(6,11)
  90. print("                ")
  91.  
  92. if DoorAuto == true and DoorManu == false then
  93. term.setBackgroundColor(colors.lightGray)
  94. term.setCursorPos(12,8)
  95. term.setTextColor(colors.cyan)
  96. print("Auto.")
  97. end
  98.  
  99. if DoorManu == true and DoorAuto == false then
  100. term.setBackgroundColor(colors.lightGray)
  101. term.setCursorPos(12,8)
  102. term.setTextColor(colors.cyan)
  103. print("Manuel")
  104. end
  105.  
  106. if DoorAuto ==false and DoorManu == false or DoorManu == true and DoorAutor == true then
  107. term.setBackgroundColor(colors.lightGray)
  108. term.setCursorPos(12,8)
  109. term.setTextColor(colors.red)
  110. print("Error")
  111. end
  112.  
  113. term.setTextColor(colors.white)
  114. term.setCursorPos(10,8)
  115. print("<")
  116.  
  117. term.setCursorPos(19,8)
  118. print(">")
  119.  
  120. term.setBackgroundColor(colors.lightGray)
  121. term.setTextColor(colors.white)
  122. term.setCursorPos(7,11)
  123. print("Save")
  124.  
  125. term.setCursorPos(16,11)
  126. print("Close")
  127.  
  128. end
  129. end
  130.  
  131. function Touch()
  132.  
  133. while run == 1 do
  134.  
  135. while true do
  136. local event, button, X, Y = os.pullEvent("mouse_click")
  137. XY = X..","..Y
  138.  
  139. if X >=18 and X <= 21 and Y ==2 and DoorSettings == false and Menu == true then
  140.      
  141. rednet.broadcast("DS")
  142. term.setCursorPos(0,0)
  143. print("DS")
  144.  
  145. DoorSettings=true
  146.  
  147. Text()
  148. Touch()
  149. end
  150.  
  151. if X >=18 and X <= 21 and Y ==2 and DoorSettings == true and Menu == true then
  152.  
  153. rednet.broadcast("DO")
  154. term.setCursorPos(0,0)
  155. print("DO")
  156.  
  157. DoorSettings=false
  158.  
  159. Text()
  160. Touch()
  161. end
  162.  
  163. if X == 25 and Y == 2 and Menu == true then
  164.  
  165. if DoorMenu==false then
  166.  
  167. Menu=false
  168. DoorMenu=true
  169. Text()
  170. Touch()
  171.  
  172. end
  173. end
  174.  
  175. if DoorMenu == true and Menu == false and Y == 8 and X == 10 or X == 19 and Y == 8 then
  176.  
  177. if DoorAuto == true then
  178. DoorAuto=false
  179. DoorManu=true
  180. Text()
  181. Touch()
  182. end
  183.  
  184. if DoorManu == true then
  185. DoorAuto=true
  186. DoorManu=false
  187. Text()
  188. Touch()
  189. end
  190. end
  191.  
  192. if X >= 16 and Y == 11 and X <= 21 then
  193.  
  194. Menu=true
  195. DoorMenu=false
  196. Text()
  197. Touch()  
  198. end
  199.  
  200. if X >= 7 and Y == 11 and X <= 11 then
  201.  
  202. term.setTextColor(colors.cyan)
  203. term.setBackgroundColor(colors.lightGray)
  204. term.setCursorPos(7,11)
  205. print("Save")
  206.  
  207. if DoorAuto == true and DoorManu == false then
  208. rednet.broadcast("DoorAuto")
  209. end
  210.  
  211. if DoorManu == false and DoorManu == true then
  212. rednet.broadcast("DoorManu")
  213. end
  214.  
  215. sleep(0.2)
  216. Text()
  217. Touch()
  218. end
  219.  
  220.  
  221.  
  222. end
  223. end
  224. end
  225.  
  226. Var()
  227. Text()
  228. Touch()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement