Guest User

aaa

a guest
May 19th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.38 KB | None | 0 0
  1. term.clear()
  2. rednet.open("left")
  3.  
  4. -- Positions
  5.  
  6. local ax, ay = 5, 6 -- Main Screen Engine Controls
  7. local bx, by = 30, 6 --Main Screen Tank Controls
  8. local dx, dy = 1, 19 -- Back Button
  9.  
  10. --Engine Status Lights Positions
  11.  
  12. local abx, aby = 5,3 -- bank1 light
  13. local acx, acy = 18, 3 -- Bank 2 Light
  14. local adx, ady = 31, 3 -- Bank 3 light
  15. local aex, aey = 5, 5 -- Bank 4 light
  16. local afx, afy = 18, 5 -- Bank 5 light
  17. local agx, agy = 31, 5 -- bank 6 light
  18.  
  19. --Engine Switches Positions
  20.  
  21. local aax, aay = 5, 7 -- Bank 1 On Button
  22. local bax, bay = 5, 8 -- Bank 1 Off Button
  23. local dax, day = 18, 7 -- Bank 2 On Button
  24. local eax, eay = 18,8 -- Bank 2 Off Button
  25. local fax, fay = 31,7 -- Bank 3 On Button
  26. local gax, gay = 31,8 --Bank 3 off button
  27. local hax, hay = 5, 11 -- Bank 4 On Button
  28. local iax, iay = 5,12 --bank 4 Off Button
  29. local jax, jay = 18, 11 -- Bank 5 On Button
  30. local kax, kay = 18, 12 -- Bank 5 off Button
  31. local lax, lay = 31, 11 -- Bank 6 on button
  32. local max, may = 31, 12 -- Bank 6 off button
  33. -- Button Text
  34.  
  35. local engcon = "[ Engine Controls ]"
  36. local tankcon = "[ Tank Controls ]"
  37. local bkbtn = "[Back]"
  38.    
  39. -- Engine Switches Text --
  40.  
  41. local bnk1on = "[Bank 1 On]"
  42. local bnk1off = "[Bank 1 Off]"
  43. local bnk2on = "[Bank 2 On]"
  44. local bnk2off = "[Bank 2 Off]"
  45. local bnk3on = "[Bank 3 On]"
  46. local bnk3off = "[Bank 3 Off]"
  47. local bnk4on = "[Bank 4 On]"
  48. local bnk4off = "[Bank 4 Off]"
  49. local bnk5on = "[Bank 5 On]"
  50. local bnk5off = "[Bank 5 Off]"
  51. local bnk6on = "[Bank 6 On]"
  52. local bnk6off = "[Bank 6 Off]"
  53.  
  54. -- Engine Status Light Text
  55.  
  56. local bnk1staton = "Bank 1 On  "
  57. local bnk1statoff = "Bank 1 Off"
  58. local bnk2staton = "Bank 2 On  "
  59. local bnk2statoff = "Bank 2 Off"
  60. local bnk3staton = "Bank 3 On  "
  61. local bnk3statoff = "Bank 3 Off"
  62. local bnk4staton = "Bank 4 On  "
  63. local bnk4statoff = "Bank 4 Off"
  64. local bnk5staton = "Bank 5 On  "
  65. local bnk5statoff = "Bank 5 Off"
  66. local bnk6staton = "Bank 6 On  "
  67. local bnk6statoff = "Bank 6 Off"
  68.  
  69. -- Main Page
  70.  
  71. function main()
  72. term.clear()
  73. term.setCursorPos(ax,ay)
  74. write(engcon)
  75. term.setCursorPos(bx,by)
  76. write(tankcon)
  77. end
  78.  
  79. -- Engine Managment Buttons
  80.  
  81. function engine1on() -- bank1 on/off
  82. while true do
  83. local e, but, cx,cy = os.pullEvent()
  84. if e =="mouse_click" then
  85. if cx >= aax and cx <= aax + bnk1on:len() and cy == aay then
  86. rednet.send(1,"on")
  87. term.setCursorPos(abx, aby)
  88. term.setTextColor(colors.green)
  89. write(bnk1staton)
  90. term.setTextColor(colors.white)
  91. end
  92. end
  93.  
  94. local e, but, cx,cy = os.pullEvent()
  95. if e =="mouse_click" then
  96. if cx >= bax and cx <= bax + bnk1off:len() and cy == bay then
  97. rednet.send(1,"off")
  98. term.setCursorPos(abx, aby)
  99. term.setTextColor(colors.red)
  100. write(bnk1statoff)
  101. term.setTextColor(colors.white)
  102. end
  103. end
  104.  
  105. while true do
  106. local e, but, cx,cy = os.pullEvent()
  107. if e =="mouse_click" then
  108. if cx >= dax and cx <= dax + bnk2on:len() and cy == day then
  109. rednet.send(4,"on")
  110. term.setCursorPos(acx, acy)
  111. term.setTextColor(colors.green)
  112. write(bnk2staton)
  113. term.setTextColor(colors.white)
  114. end
  115. end
  116.  
  117. local e, but, cx,cy = os.pullEvent()
  118. if e =="mouse_click" then
  119. if cx >= eax and cx <= eax + bnk2off:len() and cy == eay then
  120. rednet.send(4,"off")
  121. term.setCursorPos(acx, acy)
  122. term.setTextColor(colors.red)
  123. write(bnk2statoff)
  124. term.setTextColor(colors.white)
  125. end
  126. end
  127.  
  128. while true do
  129. local e, but, cx,cy = os.pullEvent()
  130. if e =="mouse_click" then
  131. if cx >= fax and cx <= fax + bnk3on:len() and cy == fay then
  132. rednet.send(5,"on")
  133. term.setCursorPos(adx, ady)
  134. term.setTextColor(colors.green)
  135. write(bnk3staton)
  136. term.setTextColor(colors.white)
  137. end
  138. end
  139.  
  140. local e, but, cx,cy = os.pullEvent()
  141. if e =="mouse_click" then
  142. if cx >= gax and cx <= gax + bnk3off:len() and cy == gay then
  143. rednet.send(5,"off")
  144. term.setCursorPos(adx, ady)
  145. term.setTextColor(colors.red)
  146. write(bnk3statoff)
  147. term.setTextColor(colors.white)
  148. end
  149. end
  150.  
  151. while true do
  152. local e, but, cx,cy = os.pullEvent()
  153. if e =="mouse_click" then
  154. if cx >= hax and cx <= hax + bnk4on:len() and cy == hay then
  155. rednet.send(6,"on")
  156. term.setCursorPos(aex, aey)
  157. term.setTextColor(colors.green)
  158. write(bnk4staton)
  159. term.setTextColor(colors.white)
  160. end
  161. end
  162.  
  163. local e, but, cx,cy = os.pullEvent()
  164. if e =="mouse_click" then
  165. if cx >= iax and cx <= iax + bnk4off:len() and cy == iay then
  166. rednet.send(6,"off")
  167. term.setCursorPos(aex, aey)
  168. term.setTextColor(colors.red)
  169. write(bnk4statoff)
  170. term.setTextColor(colors.white)
  171. end
  172. end
  173.  
  174. while true do
  175. local e, but, cx,cy = os.pullEvent()
  176. if e =="mouse_click" then
  177. if cx >= jax and cx <= jax + bnk5on:len() and cy == jay then
  178. rednet.send(7,"on")
  179. term.setCursorPos(afx, afy)
  180. term.setTextColor(colors.green)
  181. write(bnk5staton)
  182. term.setTextColor(colors.white)
  183. end
  184. end
  185.  
  186. local e, but, cx,cy = os.pullEvent()
  187. if e =="mouse_click" then
  188. if cx >= kax and cx <= kax + bnk5off:len() and cy == kay then
  189. rednet.send(7,"off")
  190. term.setCursorPos(afx, afy)
  191. term.setTextColor(colors.red)
  192. write(bnk5statoff)
  193. term.setTextColor(colors.white)
  194. end
  195. end
  196.  
  197. while true do
  198. local e, but, cx,cy = os.pullEvent()
  199. if e =="mouse_click" then
  200. if cx >= kax and cx <= kax + bnk6on:len() and cy == kay then
  201. rednet.send(8,"on")
  202. term.setCursorPos(agx, agy)
  203. term.setTextColor(colors.green)
  204. write(bnk6staton)
  205. term.setTextColor(colors.white)
  206. end
  207. end
  208.  
  209. local e, but, cx,cy = os.pullEvent()
  210. if e =="mouse_click" then
  211. if cx >= lax and cx <= lax + bnk3off:len() and cy == lay then
  212. rednet.send(8,"off")
  213. term.setCursorPos(agx, agy)
  214. term.setTextColor(colors.red)
  215. write(bnk6statoff)
  216. term.setTextColor(colors.white)
  217. end
  218.  end
  219. end
  220.  end
  221.   end
  222.    end
  223. end
  224.  end
  225.   end  
  226. -- Engine Managment Screen
  227.  
  228. function enginescreen()
  229. term.clear()
  230. term.setCursorPos(aax, aay)
  231. write(bnk1on)
  232. term.setCursorPos(bax, bay)
  233. write(bnk1off)
  234. term.setCursorPos(dax,day)
  235. write(bnk2on)
  236. term.setCursorPos (eax,eay)
  237. write(bnk2off)
  238.  
  239. term.setCursorPos(fax, fay)
  240. write(bnk3on)
  241. term.setCursorPos(gax, gay)
  242. write(bnk3off)
  243. term.setCursorPos(hax,hay)
  244. write(bnk4on)
  245. term.setCursorPos (iax,iay)
  246. write(bnk4off)
  247.  
  248. term.setCursorPos(jax, jay)
  249. write(bnk5on)
  250. term.setCursorPos(kax, kay)
  251. write(bnk5off)
  252. term.setCursorPos(lax,lay)
  253. write(bnk6on)
  254. term.setCursorPos (max,may)
  255. write(bnk6off)
  256. engine1on()
  257. end
  258. -- Home Page --
  259.  
  260.  
  261. function enginemanagment() -- engine managment function
  262. while true do
  263. local e, but, cx,cy = os.pullEvent()
  264. if e =="mouse_click" then
  265. if cx >= ax and cx <= ax + engcon:len() and cy == ay then
  266. enginescreen()
  267. end
  268.  end
  269.   end
  270.    end
  271.  
  272. main()
  273. enginemanagment()
Advertisement
Add Comment
Please, Sign In to add comment