Advertisement
Guest User

88

a guest
May 27th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.53 KB | None | 0 0
  1. -- Clears Screen & Opens Connection --
  2. term.clear()
  3. rednet.open("back")
  4.  
  5. -- Engine Status Light Positions --
  6.  
  7.  
  8. local abx, aby = 5,3 --  bank1 light
  9. local acx, acy = 18,3 -- bank2 light
  10. local adx, ady = 5,5 --  bank3 light
  11. local aex, aey = 18,5 -- bank4 light
  12.  
  13.  
  14. -- Engine Button Positions --
  15.  
  16. local aax, aay = 5,7 --  bank1 on button
  17. local bax, bay = 5,8 --  bank1 off button
  18. local cax, cay = 18,7 -- bank2 on button
  19. local dax, day = 18,8 -- bank2 off button
  20. local eax, eay = 5,11 -- bank3 on button
  21. local fax, fay = 5,12 -- bank3 off button
  22. local gax, gay = 18,11-- bank4 on button
  23. local hax, hay = 18,12-- bank4 off button
  24.  
  25. -- Engine Button Text --
  26.  
  27. local bnk1on = "[Bank 1 On]"
  28. local bnk1off = "[Bank 1 Off]"
  29. local bnk2on = "[Bank 2 On]"
  30. local bnk2off = "[Bank 2 Off]"
  31. local bnk3on = "[Bank 3 On]"
  32. local bnk3off = "[Bank 3 Off]"
  33. local bnk4on = "[Bank 4 On]"
  34. local bnk4off = "[Bank 4 Off]"
  35.  
  36. -- Engine Status Light Text --
  37.  
  38. local bnk1staton = "Bank 1 On  "
  39. local bnk1statoff = "Bank 1 Off"
  40. local bnk2staton = "Bank 2 On  "
  41. local bnk2statoff = "Bank 2 Off"
  42. local bnk3staton = "Bank 3 On  "
  43. local bnk3statoff = "Bank 3 Off"
  44. local bnk4staton = "Bank 4 On  "
  45. local bnk4statoff = "Bank 4 Off"
  46.  
  47. -- Button Placing --
  48.  
  49. term.clear()
  50. term.setCursorPos(aax, aay)
  51. write(bnk1on)
  52. term.setCursorPos(bax, bay)
  53. write(bnk1off)
  54. term.setCursorPos(cax,cay)
  55. write(bnk2on)
  56. term.setCursorPos (dax,day)
  57. write(bnk2off)
  58.  
  59. term.setCursorPos(eax, eay)
  60. write(bnk3on)
  61. term.setCursorPos(fax, fay)
  62. write(bnk3off)
  63. term.setCursorPos(gax,gay)
  64. write(bnk4on)
  65. term.setCursorPos (hax,hay)
  66. write(bnk4off)
  67.  
  68.  
  69.  
  70. -- Engine Button Code --
  71.  
  72. while true do
  73. local e, but, cx,cy = os.pullEvent()
  74. if e =="mouse_click" then
  75. if cx >= aax and cx <= aax + bnk1on:len() and cy == aay then
  76. rednet.send(0,"on")
  77. term.setCursorPos(abx, aby)
  78. term.setTextColor(colors.green)
  79. write(bnk1staton)
  80. term.setTextColor(colors.white)
  81. end
  82. end
  83.  
  84. if e =="mouse_click" then
  85. if cx >= bax and cx <= bax + bnk1off:len() and cy == bay then
  86. rednet.send(0,"off")
  87. term.setCursorPos(abx, aby)
  88. term.setTextColor(colors.red)
  89. write(bnk1statoff)
  90. term.setTextColor(colors.white)
  91. end
  92. end
  93.  
  94. if e =="mouse_click" then
  95. if cx >= cax and cx <= cax + bnk2on:len() and cy == cay then
  96. rednet.send(1,"on")
  97. term.setCursorPos(acx, acy)
  98. term.setTextColor(colors.green)
  99. write(bnk2staton)
  100. term.setTextColor(colors.white)
  101. end
  102. end
  103.  
  104. if e =="mouse_click" then
  105. if cx >= dax and cx <= dax + bnk2off:len() and cy == day then
  106. rednet.send(1,"off")
  107. term.setCursorPos(acx, acy)
  108. term.setTextColor(colors.red)
  109. write(bnk2statoff)
  110. term.setTextColor(colors.white)
  111. end
  112. end
  113.  
  114. if e =="mouse_click" then
  115. if cx >= eax and cx <= eax + bnk3on:len() and cy == eay then
  116. rednet.send(3,"on")
  117. term.setCursorPos(adx, ady)
  118. term.setTextColor(colors.green)
  119. write(bnk3staton)
  120. term.setTextColor(colors.white)
  121. end
  122. end
  123.  
  124. if e =="mouse_click" then
  125. if cx >= fax and cx <= fax + bnk3off:len() and cy == fay then
  126. rednet.send(3,"off")
  127. term.setCursorPos(adx, ady)
  128. term.setTextColor(colors.red)
  129. write(bnk3statoff)
  130. term.setTextColor(colors.white)
  131. end
  132. end
  133.  
  134. if e =="mouse_click" then
  135. if cx >= gax and cx <= gax + bnk4on:len() and cy == gay then
  136. rednet.send(4,"on")
  137. term.setCursorPos(aex, aey)
  138. term.setTextColor(colors.green)
  139. write(bnk4staton)
  140. term.setTextColor(colors.white)
  141. end
  142. end
  143.  
  144. if e =="mouse_click" then
  145. if cx >= hax and cx <= hax + bnk4off:len() and cy == hay then
  146. rednet.send(4,"off")
  147. term.setCursorPos(aex, aey)
  148. term.setTextColor(colors.red)
  149. write(bnk4statoff)
  150. term.setTextColor(colors.white)
  151. end
  152. end
  153.  
  154. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement