Advertisement
McMrARM

Wireless Big Reactor Monitor program PE

Jul 3rd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Remote Wireless Big Reactor Control(monitor) by Disappearer
  2. -- This program need a wireless modem,advanced computer
  3. -- and at least 4 monitors to view informations normally.
  4. -- If you have different setup than one shown on screens
  5. -- edit these four variables below.
  6.  
  7. rednet.open("back") -- side of wireless modem
  8. local dataprotocol = "data" -- data protocol
  9. local powerprotocol = "power" -- power protocol
  10.  
  11. function printdata()
  12. local id, mes, pro = rednet.receive(dataprotocol)
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. if mes == false then
  16. write("STATUS: ")
  17. term.setBackgroundColour(colors.red)
  18. write("ERROR")
  19. term.setBackgroundColour(colors.black)
  20. print()
  21. print()
  22. print("Something is wrong with program or reactor setup")
  23. print("Press Ctrl+T to terminate program")
  24. else
  25. write("STATUS: ")
  26. if mes.active == true then
  27. term.setBackgroundColour(colors.lime)
  28. write("ACTIVE")
  29. elseif mes.active == false then
  30. term.setBackgroundColour(colors.yellow)
  31. write("NOT ACTIVE")
  32. end
  33. term.setBackgroundColour(colors.black)
  34. print()
  35. print()
  36. print("Rods Level:        " .. 100-tostring(mes.rodlevel) .." %")
  37. print("Energy Production: " .. math.floor(mes.energylasttick,0) .. " RF/t")
  38. print("Energy Stored:     " .. mes.energystored .. " RF")
  39. print()
  40. print("Fuel:              " .. mes.fuelamount .. "/" .. mes.fuelmax .. " mB")
  41. print("Fuel Usage:        " .. math.ceil(mes.fueleatlasttick*100)/100 .. " mB/t")
  42. print("Fuel Temperature:  " .. math.floor(mes.fueltemp,1) .. " C")
  43. print("Fuel Reactivity:   " .. math.floor(mes.fuelreact,1) .. " %")
  44. print("Waste:             " .. mes.wasteamount .. " mB")
  45. print()
  46. print("Casing Temperature:" .. math.floor(mes.casingtemp,1) .. " C")
  47. print()
  48. term.setBackgroundColour(colors.orange)
  49. write("POWER ")
  50. term.setBackgroundColour(colors.black)
  51. write(" ")
  52. term.setBackgroundColour(colors.gray)
  53. write("   RODS LEVEL   ")
  54. print()
  55. term.setBackgroundColour(colors.orange)
  56. write("SWITCH")
  57. term.setBackgroundColour(colors.black)
  58. write(" ")
  59. term.setBackgroundColour(colors.gray)
  60. write("|<")
  61. term.setBackgroundColour(colors.black)
  62. write(" ")
  63. term.setBackgroundColour(colors.gray)
  64. write("<<")
  65. term.setBackgroundColour(colors.black)
  66. write(" ")
  67. term.setBackgroundColour(colors.gray)
  68. write("<")
  69. term.setBackgroundColour(colors.black)
  70. write("  ")
  71. term.setBackgroundColour(colors.gray)
  72. write(">")
  73. term.setBackgroundColour(colors.black)
  74. write(" ")
  75. term.setBackgroundColour(colors.gray)
  76. write(">>")
  77. term.setBackgroundColour(colors.black)
  78. write(" ")
  79. term.setBackgroundColour(colors.gray)
  80. write(">|")
  81. term.setBackgroundColour(colors.black)
  82.  
  83. end
  84. sleep(0.11)
  85. end
  86.  
  87.  
  88. function sendpower()
  89.  
  90. local event, par1, tx, ty = os.pullEvent()
  91. if event == "monitor_touch"  then
  92.  
  93. if tx == 8 or tx == 9 and ty == 16 then
  94. rednet.broadcast("zero",powerprotocol)
  95.  
  96. elseif tx == 11 or tx == 12 and ty == 16 then
  97. rednet.broadcast("minusten",powerprotocol)
  98.  
  99.  
  100. elseif tx == 14 and ty == 16 then
  101. rednet.broadcast("minus",powerprotocol)
  102.  
  103.  
  104. elseif tx == 17 and ty == 16 then
  105. rednet.broadcast("plus",powerprotocol)
  106.  
  107.  
  108. elseif tx == 19 or tx == 20 and ty == 16 then
  109. rednet.broadcast("plusten",powerprotocol)
  110.  
  111. elseif tx == 22 or tx == 24 and ty == 16 then
  112. rednet.broadcast("sto",powerprotocol)
  113.  
  114. elseif tx<7 and ty == 15 or tx<7 and ty == 16 then
  115. rednet.broadcast("poweron",powerprotocol)
  116. end
  117. end
  118. end
  119.  
  120. while true do
  121. parallel.waitForAny(printdata,sendpower)
  122. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement