Advertisement
Plazter

test

Aug 27th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.58 KB | None | 0 0
  1. os.loadAPI("c")
  2.  
  3.  
  4. rednet.open("back")
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. term.setTextColor(colors.orange)
  8. c.centerText("Wireless Power Control")
  9. term.setCursorPos(1,2)
  10. term.setTextColor(colors.white)
  11. print("AE Control: -")
  12. print("On / Off")
  13.  
  14. term.setCursorPos(15,2)
  15. print("Plaz Power:")
  16. term.setCursorPos(15,3)
  17. print("On / Off")
  18.  
  19. term.setCursorPos(1,5)
  20. print("Sus Power:")
  21. print("On / Off")
  22.  
  23. term.setCursorPos(13,5)
  24. print("- Kezza power:")
  25. term.setCursorPos(15,6)
  26. print("On / Off")
  27.  
  28. term.setCursorPos(22,19)
  29. term.setTextColor(colors.orange)
  30. print("Exit")
  31. term.setTextColor(colors.white)
  32. term.setCursorPos(1,13)
  33. term.setBackgroundColor(colors.blue)
  34. c.centerText("UPDATE")
  35. term.setBackgroundColor(colors.black)
  36. term.setCursorPos(1,14)
  37. print("Plaz status : ")
  38. term.setCursorPos(1,15)
  39. print("AE Status   : ")
  40. term.setCursorPos(1,16)
  41. print("Sus status  : ")
  42. term.setCursorPos(1,17)
  43. print("Kezza status:")
  44.  
  45. while true do
  46. event, side, x, y = os.pullEvent("mouse_click")
  47. if x >= 22 and x < 26 and y == 19 then
  48.   term.clear()
  49.   break
  50. end
  51.  
  52. if x >= 1 and x < 10 and y == 14 then
  53.   rednet.send(71, "status")
  54.  id, msg = rednet.receive()
  55.   if id == 71 then
  56.   term.setCursorPos(14,14)
  57.   if msg == "true" then
  58.   term.setCursorPos(14,14)
  59.   term.setBackgroundColor(colors.black)
  60.   print(" ")
  61.   term.setBackgroundColor(colors.lime)
  62.   term.setCursorPos(15,14)
  63.   else
  64.   term.setBackgroundColor(colors.red)
  65.   term.setCursorPos(14,14)
  66.   end
  67.   print(msg)
  68.   end
  69. term.setBackgroundColor(colors.black)
  70. end
  71. if x >= 1 and x < 10 and y == 15 then
  72.   rednet.send(69, "status")
  73.   id, msg = rednet.receive()
  74.   if id == 69 then
  75.   term.setCursorPos(15,15)
  76.   if msg == "true" then
  77.   term.setCursorPos(14,15)
  78.   term.setBackgroundColor(colors.black)
  79.   print(" ")
  80.   term.setBackgroundColor(colors.lime)
  81.   term.setCursorPos(15,15)
  82.   else
  83.   term.setBackgroundColor(colors.red)
  84.   term.setCursorPos(14,15)
  85.   end
  86.   print(msg)
  87.   end
  88. end  
  89.  
  90. if x >= 1 and x < 10 and y == 16 then
  91.   rednet.send(72, "status")
  92.   id, msg = rednet.receive()  
  93.   if id == 72 then
  94.     if msg == "true" then
  95.   term.setCursorPos(14,16)
  96.   term.setBackgroundColor(colors.black)
  97.   print(" ")
  98.   term.setBackgroundColor(colors.lime)
  99.   term.setCursorPos(15,16)
  100.   else
  101.   term.setBackgroundColor(colors.red)
  102.   term.setCursorPos(14,16)
  103.   end
  104.     print(msg)
  105.   end
  106. end  
  107.  
  108. if x >= 1 and x < 10 and y == 17 then
  109.   rednet.send(73, "status")
  110.   id, msg = rednet.receive()    
  111.   if id == 73 then
  112.    if msg == "true" then
  113.   term.setCursorPos(14,17)
  114.   term.setBackgroundColor(colors.black)
  115.   print(" ")
  116.   term.setBackgroundColor(colors.lime)
  117.   term.setCursorPos(15,17)
  118.   else
  119.   term.setBackgroundColor(colors.red)
  120.   term.setCursorPos(14,17)
  121.   end
  122.     print(msg)
  123.   end
  124. end
  125.  
  126. if x >= 1 and x < 3 and y == 3 then
  127.   term.setCursorPos(1,3)
  128.   term.setBackgroundColor(colors.lime)
  129.   print("On")
  130.   term.setCursorPos(6,3)
  131.   term.setBackgroundColor(colors.black)
  132.   print("Off")
  133.   rednet.send(69, "on")
  134.  
  135. end
  136.  
  137. if x > 4 and x < 9 and y == 3 then
  138.   rednet.send(69, "off")
  139.   term.setCursorPos(1,3)
  140.   term.setBackgroundColor(colors.black)
  141.   print("On ")
  142.   term.setCursorPos(6,3)
  143.   term.setBackgroundColor(colors.red)
  144.   print("Off")
  145. end
  146.  
  147. if x > 15 and x <17 and y == 3 then
  148.   rednet.send(71, "on")
  149.   term.setCursorPos(15,3)
  150.   term.setBackgroundColor(colors.lime)
  151.   print("On")
  152.   term.setCursorPos(20,3)
  153.   term.setBackgroundColor(colors.black)
  154.   print("Off")
  155. end
  156. if x > 20 and x < 27 and y == 3 then
  157.   rednet.send(71, "off")
  158.   term.setCursorPos(15,3)
  159.   term.setBackgroundColor(colors.black)
  160.   print("On")
  161.   term.setCursorPos(20,3)
  162.   term.setBackgroundColor(colors.red)
  163.   print("Off")
  164. end
  165.  
  166. if x >= 1 and x < 3 and y == 6 then
  167.   rednet.send(72, "on")
  168.   term.setCursorPos(1,6)
  169.   term.setBackgroundColor(colors.lime)
  170.   print("On")
  171.   term.setCursorPos(6,6)
  172.   term.setBackgroundColor(colors.black)
  173.   print("Off")
  174. end
  175.  
  176. if x >= 6 and x < 9 and y == 6 then
  177.   rednet.send(72, "off")
  178.   term.setCursorPos(1,6)
  179.   term.setBackgroundColor(colors.black)
  180.   print("On")
  181.   term.setCursorPos(6,6)
  182.   term.setBackgroundColor(colors.red)
  183.   print("Off")
  184. end
  185.  
  186. if x >= 15 and x < 16 and y == 6 then
  187.   rednet.send(73, "on")
  188.   term.setCursorPos(15,6)
  189.   term.setBackgroundColor(colors.lime)
  190.   print("On")
  191.   term.setCursorPos(20,6)
  192.   term.setBackgroundColor(colors.black)
  193.   print("Off")
  194. end
  195.  
  196. if x >= 20 and x < 24 and y == 6 then
  197.   rednet.send(73, "off")
  198.   term.setCursorPos(15,6)
  199.   term.setBackgroundColor(colors.black)
  200.   print("On")
  201.   term.setCursorPos(20,6)
  202.   term.setBackgroundColor(colors.red)
  203.   print("Off")
  204. end
  205. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement