Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- os.loadAPI("/rom/apis/rednet")
- m = peripheral.wrap("monitor_0")
- p = peripheral.wrap("back")
- os.loadAPI("/rom/apis/rednet")
- rednet.open("bottom")
- m.clear()
- xm1 = 0 --Counter for receiving no message from computer RC(x)
- xm2 = 0 --Counter for receiving no message from computer RC(x)
- xm3 = 0 --Counter for receiving no message from computer RC(x)
- xm4 = 0 --Counter for receiving no message from computer RC(x)
- xm5 = 0 --Counter for receiving no message from computer RC(x)
- xm6 = 0 --Counter for receiving no message from computer RC(x)
- local rfp1 = "reactor_fluid_port_15" -- Location Reactor Fluid Port
- local rfp2 = "reactor_fluid_port_16" -- Location Reactor Fluid Port
- local rfp3 = "reactor_fluid_port_17" -- Location Reactor Fluid Port
- local rfp4 = "reactor_fluid_port_18" -- Location Reactor Fluid Port
- local rfp5 = "reactor_fluid_port_19" -- Location Reactor Fluid Port
- local rfp6 = "reactor_fluid_port_20" -- Location Reactor Fluid Port
- local nr1 = "nuclear_reactor_7" -- Location Reactor Access Hatch
- local nr2 = "nuclear_reactor_8" -- Location Reactor Access Hatch
- local nr3 = "nuclear_reactor_9" -- Location Reactor Access Hatch
- local nr4 = "nuclear_reactor_10" -- Location Reactor Access Hatch
- local nr5 = "nuclear_reactor_11" -- Location Reactor Access Hatch
- local nr6 = "nuclear_reactor_12" -- Location Reactor Access Hatch
- --MFSU's
- --Groep 1
- local mfsu1 = nil -- Location R1A
- local mfsu2 = nil -- Location R1B
- local mfsu3 = nil -- Location R2A
- local mfsu4 = nil -- Location R2B
- local mfsu5 = nil -- Location MFSU Group 1
- local mfsug1_6 = nil
- local mfsug1_7 = nil
- local mfsug1_8 = nil
- local mfsug1_9 = nil
- local mfsug1_10 = nil
- --Groep 2
- local mfsu6 = nil -- Location R1A
- local mfsu7 = nil -- Location R1B
- local mfsu8 = nil -- Location R2A
- local mfsu9 = nil -- Location R2B
- local mfsu10 = nil -- Location MFSU Group 2
- local mfsug2_6 = nil
- local mfsug2_7 = nil
- local mfsug2_8 = nil
- local mfsug2_9 = nil
- local mfsug2_10 = nil
- --Groep 3
- local mfsu11 = nil -- Location R1A
- local mfsu12 = nil -- Location R1B
- local mfsu13 = nil -- Location R2A
- local mfsu14 = nil -- Location R2B
- local mfsu15 = nil -- Location MFSU Group 3
- local mfsug3_6 = nil
- local mfsug3_7 = nil
- local mfsug3_8 = nil
- local mfsug3_9 = nil
- local mfsug3_10 = nil
- --MFSU's
- --Groep 1
- mfsu_1 = "mfsu_12" -- Location MFSU1
- mfsu_2 = "mfsu_10" -- Location MFSU2
- mfsu_3 = "mfsu_11" -- Location MFSU3
- mfsu_4 = "mfsu_9" -- Location MFSU4
- mfsu_5 = "mfsu_1" -- Location MFSU5
- v_mfsug1_6 = "mfsu_21" -- Location MFSU5
- v_mfsug1_7 = "mfsu_22" -- Location MFSU5
- v_mfsug1_8 = "mfsu_23" -- Location MFSU5
- v_mfsug1_9 = "mfsu_24" -- Location MFSU5
- v_mfsug1_10 = "mfsu_33" -- Location MFSU5
- --Groep 2
- mfsu_6 = "mfsu_15" -- Location MFSU6
- mfsu_7 = "mfsu_13" -- Location MFSU7
- mfsu_8 = "mfsu_16" -- Location MFSU8
- mfsu_9 = "mfsu_14" -- Location MFSU9
- mfsu_10 = "mfsu_4" -- Location MFSU4
- v_mfsug2_6 = "mfsu_25" -- Location MFSU5
- v_mfsug2_7 = "mfsu_26" -- Location MFSU5
- v_mfsug2_8 = "mfsu_27" -- Location MFSU5
- v_mfsug2_9 = "mfsu_28" -- Location MFSU5
- v_mfsug2_10 = "mfsu_34" -- Location MFSU5
- --Groep 3
- mfsu_11 = "mfsu_17" -- Location MFSU5
- mfsu_12 = "mfsu_19" -- Location MFSU6
- mfsu_13 = "mfsu_18" -- Location MFSU7
- mfsu_14 = "mfsu_20" -- Location MFSU8
- mfsu_15 = "mfsu_7" -- Location MFSU9
- v_mfsug3_6 = "mfsu_29" -- Location MFSU5
- v_mfsug3_7 = "mfsu_30" -- Location MFSU5
- v_mfsug3_8 = "mfsu_31" -- Location MFSU5
- v_mfsug3_9 = "mfsu_32" -- Location MFSU5
- v_mfsug3_10 = "mfsu_35" -- Location MFSU5
- local IsActive = "PlaceHolder"
- --computers that can send wireless signals
- local rc1 = rednet.lookup("rctrl","rc1")
- if tonumber(rc1) == nil then
- sleep(5)
- local rc1 = rednet.lookup("rctrl","rc1")
- if tonumber(rc1) == nil then
- rc1 = 0
- end
- end
- local rc2 = rednet.lookup("rctrl","rc2")
- if tonumber(rc2) == nil then
- sleep(5)
- local rc2 = rednet.lookup("rctrl","rc2")
- if tonumber(rc2) == nil then
- rc2 = 0
- end
- end
- local rc3 = rednet.lookup("rctrl","rc3")
- if tonumber(rc3) == nil then
- sleep(5)
- local rc3 = rednet.lookup("rctrl","rc3")
- if tonumber(rc3) == nil then
- rc3 = 0
- end
- end
- local rc4 = rednet.lookup("rctrl","rc4")
- if tonumber(rc4) == nil then
- sleep(5)
- local rc4 = rednet.lookup("rctrl","rc4")
- if tonumber(rc4) == nil then
- rc4 = 0
- end
- end
- local rc5 = rednet.lookup("rctrl","rc5")
- if tonumber(rc5) == nil then
- sleep(5)
- local rc5 = rednet.lookup("rctrl","rc5")
- if tonumber(rc5) == nil then
- rc5 = 0
- end
- end
- local rc6 = rednet.lookup("rctrl","rc6")
- if tonumber(rc6) == nil then
- sleep(5)
- local rc6 = rednet.lookup("rctrl","rc6")
- if tonumber(rc6) == nil then
- rc6 = 0
- end
- end
- --computers that are under the reactors
- local rs1 = rednet.lookup("rctrl","rs1")
- local rs2 = rednet.lookup("rctrl","rs2")
- local rs3 = rednet.lookup("rctrl","rs3")
- local rs4 = rednet.lookup("rctrl","rs4")
- local rs5 = rednet.lookup("rctrl","rs5")
- local rs6 = rednet.lookup("rctrl","rs6")
- R1OnOff = "Off"
- R2OnOff = "Off"
- R3OnOff = "Off"
- R4OnOff = "Off"
- R5OnOff = "Off"
- R6OnOff = "Off"
- mfsu1 = peripheral.wrap(mfsu_1)
- mfsu2 = peripheral.wrap(mfsu_2)
- mfsu3 = peripheral.wrap(mfsu_3)
- mfsu4 = peripheral.wrap(mfsu_4)
- mfsu5 = peripheral.wrap(mfsu_5)
- mfsu6 = peripheral.wrap(mfsu_6)
- mfsu7 = peripheral.wrap(mfsu_7)
- mfsu8 = peripheral.wrap(mfsu_8)
- mfsu9 = peripheral.wrap(mfsu_9)
- mfsug1_6 = peripheral.wrap(v_mfsug1_6)
- mfsug1_7 = peripheral.wrap(v_mfsug1_7)
- mfsug1_8 = peripheral.wrap(v_mfsug1_8)
- mfsug1_9 = peripheral.wrap(v_mfsug1_9)
- mfsug1_10 = peripheral.wrap(v_mfsug1_10)
- mfsug2_6 = peripheral.wrap(v_mfsug2_6)
- mfsug2_7 = peripheral.wrap(v_mfsug2_7)
- mfsug2_8 = peripheral.wrap(v_mfsug2_8)
- mfsug2_9 = peripheral.wrap(v_mfsug2_9)
- mfsug2_10 = peripheral.wrap(v_mfsug2_10)
- mfsug3_6 = peripheral.wrap(v_mfsug3_6)
- mfsug3_7 = peripheral.wrap(v_mfsug3_7)
- mfsug3_8 = peripheral.wrap(v_mfsug3_8)
- mfsug3_9 = peripheral.wrap(v_mfsug3_9)
- mfsug3_10 = peripheral.wrap(v_mfsug3_10)
- local rg1a = colors.white
- local rg1b = colors.orange
- local rg2a = colors.magenta
- local rg2b = colors.lightBlue
- local rg3a = colors.yellow
- local rg3b = colors.lime
- local rg4a = colors.pink
- local rg4b = colors.gray
- local rg5a = colors.lightGray
- local rg5b = colors.cyan
- local rg6a = colors.purple
- local rg6b = colors.blue
- function rgCheck()
- -- Check Reactor Generators
- senderIdLrgA = {}
- vMLrgA = {}
- vPLrgA = {}
- senderIdLrgB = {}
- vMLrgB = {}
- vPLrgB = {}
- m.setCursorPos(42,1) m.write("--Power Generators--")
- while true do
- sleep(0.5)
- cnt = 0
- for cnt = 1,6 do
- senderIdLrgA[cnt], vMLrgA[cnt], vPLrgA[cnt] = rednet.receive("RG"..cnt.."A",6)
- print(tostring(senderIdLrgA[cnt])..":"..tostring(vMLrgA[cnt])..":"..tostring(vPLrgA[cnt]).." RG"..cnt.."A")
- end
- cnt = 0
- for cnt = 1,6 do
- senderIdLrgB[cnt], vMLrgB[cnt], vPLrgB[cnt] = rednet.receive("RG"..cnt.."B",6)
- print(tostring(senderIdLrgB[cnt])..":"..tostring(vMLrgB[cnt])..":"..tostring(vPLrgB[cnt]).." RG"..cnt.."B")
- end
- cnt = 0
- -- for cnt = 1,6 do
- -- print(senderIdLrgB[cnt]..":"..vMLrgB[cnt]..":"..vPLrgB[cnt].." RG"..cnt.."B")
- -- end
- -- cnt = 0
- rg1aStat = vMLrgA[1]
- rg2aStat = vMLrgA[2]
- rg3aStat = vMLrgA[3]
- rg4aStat = vMLrgA[4]
- rg5aStat = vMLrgA[5]
- rg6aStat = vMLrgA[6]
- rg1bStat = vMLrgB[1]
- rg2bStat = vMLrgB[2]
- rg3bStat = vMLrgB[3]
- rg4bStat = vMLrgB[4]
- rg5bStat = vMLrgB[5]
- rg6bStat = vMLrgB[6]
- if rg1bStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(42,2) m.write("RG1B")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(42,2) m.write("RG1B")
- m.setBackgroundColor(colors.black)
- end
- if rg1aStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(42,4) m.write("RG1A")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(42,4) m.write("RG1A")
- m.setBackgroundColor(colors.black)
- end
- if rg2bStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(47,2) m.write("RG2B")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(47,2) m.write("RG2B")
- m.setBackgroundColor(colors.black)
- end
- if rg2aStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(47,4) m.write("RG2A")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(47,4) m.write("RG2A")
- m.setBackgroundColor(colors.black)
- end
- if rg3bStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(52,2) m.write("RG3B")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(52,2) m.write("RG3B")
- m.setBackgroundColor(colors.black)
- end
- if rg3aStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(52,4) m.write("RG3A")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(52,4) m.write("RG3A")
- m.setBackgroundColor(colors.black)
- end
- if rg4bStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(57,2) m.write("RG4B")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(57,2) m.write("RG4B")
- m.setBackgroundColor(colors.black)
- end
- if rg4aStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(57,4) m.write("RG4A")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(57,4) m.write("RG4A")
- m.setBackgroundColor(colors.black)
- end
- if rg5bStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(62,2) m.write("RG5B")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(62,2) m.write("RG5B")
- m.setBackgroundColor(colors.black)
- end
- if rg5aStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(62,4) m.write("RG5A")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(62,4) m.write("RG5A")
- m.setBackgroundColor(colors.black)
- end
- if rg6bStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(67,2) m.write("RG6B")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(67,2) m.write("RG6B")
- m.setBackgroundColor(colors.black)
- end
- if rg6aStat == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(67,4) m.write("RG6A")
- m.setBackgroundColor(colors.black)
- else
- m.setBackgroundColor(colors.green)
- m.setCursorPos(67,4) m.write("RG6A")
- m.setBackgroundColor(colors.black)
- end
- cnt = 0
- for cnt = 1,6 do
- senderIdLrgA[cnt] = nil
- vMLrgA[cnt] = nil
- vPLrgA[cnt] = nil
- senderIdLrgB[cnt] = nil
- vMLrgB[cnt] = nil
- vPLrgB[cnt] = nil
- end
- cnt = 0
- end
- end
- function mfsuAll()
- while true do
- sleep(0.5)
- --1 Check if peripheral is connected
- if mfsu1 ~= nil then
- --User value
- mfsu1EUS = mfsu1.getEUStored()
- else
- --reconnect
- mfsu1 = peripheral.wrap(mfsu_1)
- if mfsu1 ~= nil then
- --Check if peripheral is connected
- mfsu1EUS = mfsu1.getEUStored()
- else
- --unable to connect, set to 0
- mfsu1EUS = 0
- end
- end
- --2 Check if peripheral is connected
- if mfsu2 ~= nil then
- --User value
- mfsu2EUS = mfsu2.getEUStored()
- else
- --reconnect
- mfsu2 = peripheral.wrap(mfsu_2)
- if mfsu2 ~= nil then
- --Check if peripheral is connected
- mfsu2EUS = mfsu2.getEUStored()
- else
- --unable to connect, set to 0
- mfsu2EUS = 0
- end
- end
- --3 Check if peripheral is connected
- if mfsu3 ~= nil then
- --User value
- mfsu3EUS = mfsu3.getEUStored()
- else
- --reconnect
- mfsu3 = peripheral.wrap(mfsu_3)
- if mfsu3 ~= nil then
- --Check if peripheral is connected
- mfsu3EUS = mfsu3.getEUStored()
- else
- --unable to connect, set to 0
- mfsu3EUS = 0
- end
- end
- --4 Check if peripheral is connected
- if mfsu4 ~= nil then
- --User value
- mfsu4EUS = mfsu4.getEUStored()
- else
- --reconnect
- mfsu4 = peripheral.wrap(mfsu_4)
- if mfsu4 ~= nil then
- --Check if peripheral is connected
- mfsu4EUS = mfsu4.getEUStored()
- else
- --unable to connect, set to 0
- mfsu4EUS = 0
- end
- end
- --5 Check if peripheral is connected
- if mfsu5 ~= nil then
- --User value
- mfsu5EUS = mfsu5.getEUStored()
- else
- --reconnect
- mfsu5 = peripheral.wrap(mfsu_5)
- if mfsu1 ~= nil then
- --Check if peripheral is connected
- mfsu5EUS = mfsu5.getEUStored()
- else
- --unable to connect, set to 0
- mfsu5EUS = 0
- end
- end
- --6 Check if peripheral is connected
- if mfsu6 ~= nil then
- --User value
- mfsu6EUS = mfsu6.getEUStored()
- else
- --reconnect
- mfsu6 = peripheral.wrap(mfsu_6)
- if mfsu6 ~= nil then
- --Check if peripheral is connected
- mfsu6EUS = mfsu6.getEUStored()
- else
- --unable to connect, set to 0
- mfsu6EUS = 0
- end
- end
- --7 Check if peripheral is connected
- if mfsu7 ~= nil then
- --User value
- mfsu7EUS = mfsu7.getEUStored()
- else
- --reconnect
- mfsu7 = peripheral.wrap(mfsu_7)
- if mfsu7 ~= nil then
- --Check if peripheral is connected
- mfsu7EUS = mfsu7.getEUStored()
- else
- --unable to connect, set to 0
- mfsu7EUS = 0
- end
- end
- --8 Check if peripheral is connected
- if mfsu8 ~= nil then
- --User value
- mfsu8EUS = mfsu8.getEUStored()
- else
- --reconnect
- mfsu8 = peripheral.wrap(mfsu_8)
- if mfsu8 ~= nil then
- --Check if peripheral is connected
- mfsu8EUS = mfsu8.getEUStored()
- else
- --unable to connect, set to 0
- mfsu8EUS = 0
- end
- end
- --9 Check if peripheral is connected
- if mfsu9 ~= nil then
- --User value
- mfsu9EUS = mfsu9.getEUStored()
- else
- --reconnect
- mfsu9 = peripheral.wrap(mfsu_9)
- if mfsu9 ~= nil then
- --Check if peripheral is connected
- mfsu9EUS = mfsu9.getEUStored()
- else
- --unable to connect, set to 0
- mfsu9EUS = 0
- end
- end
- --10 Check if peripheral is connected
- if mfsu10 ~= nil then
- --User value
- mfsu10EUS = mfsu10.getEUStored()
- else
- --reconnect
- mfsu10 = peripheral.wrap(mfsu_10)
- if mfsu10 ~= nil then
- --Check if peripheral is connected
- mfsu10EUS = mfsu10.getEUStored()
- else
- --unable to connect, set to 0
- mfsu10EUS = 0
- end
- end
- --11 Check if peripheral is connected
- if mfsu11 ~= nil then
- --User value
- mfsu11EUS = mfsu11.getEUStored()
- else
- --reconnect
- mfsu11 = peripheral.wrap(mfsu_11)
- if mfsu11 ~= nil then
- --Check if peripheral is connected
- mfsu11EUS = mfsu11.getEUStored()
- else
- --unable to connect, set to 0
- mfsu11EUS = 0
- end
- end
- --12 Check if peripheral is connected
- if mfsu12 ~= nil then
- --User value
- mfsu12EUS = mfsu12.getEUStored()
- else
- --reconnect
- mfsu12 = peripheral.wrap(mfsu_12)
- if mfsu12 ~= nil then
- --Check if peripheral is connected
- mfsu12EUS = mfsu12.getEUStored()
- else
- --unable to connect, set to 0
- mfsu12EUS = 0
- end
- end
- --13 Check if peripheral is connected
- if mfsu13 ~= nil then
- --User value
- mfsu13EUS = mfsu13.getEUStored()
- else
- --reconnect
- mfsu13 = peripheral.wrap(mfsu_13)
- if mfsu13 ~= nil then
- --Check if peripheral is connected
- mfsu13EUS = mfsu13.getEUStored()
- else
- --unable to connect, set to 0
- mfsu13EUS = 0
- end
- end
- --14 Check if peripheral is connected
- if mfsu14 ~= nil then
- --User value
- mfsu14EUS = mfsu14.getEUStored()
- else
- --reconnect
- mfsu14 = peripheral.wrap(mfsu_14)
- if mfsu14 ~= nil then
- --Check if peripheral is connected
- mfsu14EUS = mfsu14.getEUStored()
- else
- --unable to connect, set to 0
- mfsu14EUS = 0
- end
- end
- --15 Check if peripheral is connected
- if mfsu15 ~= nil then
- --User value
- mfsu15EUS = mfsu15.getEUStored()
- else
- --reconnect
- mfsu15 = peripheral.wrap(mfsu_15)
- if mfsu15 ~= nil then
- --Check if peripheral is connected
- mfsu15EUS = mfsu15.getEUStored()
- else
- --unable to connect, set to 0
- mfsu15EUS = 0
- end
- end
- ---------------------------------------------------------------------------------------------------------------------------------
- --mfsug1_6 Check if peripheral is connected
- if mfsug1_6 ~= nil then
- --User value
- mfsug1_6EUS = mfsug1_6.getEUStored()
- else
- --reconnect
- mfsug1_6 = peripheral.wrap(v_mfsug1_6)
- if mfsug1_6 ~= nil then
- --Check if peripheral is connected
- mfsug1_6EUS = mfsug1_6.getEUStored()
- else
- --unable to connect, set to 0
- mfsug1_6EUS = 0
- end
- end
- --mfsug1_7 Check if peripheral is connected
- if mfsug1_7 ~= nil then
- --User value
- mfsug1_7EUS = mfsug1_7.getEUStored()
- else
- --reconnect
- mfsug1_7 = peripheral.wrap(v_mfsug1_7)
- if mfsug1_7 ~= nil then
- --Check if peripheral is connected
- mfsug1_7EUS = mfsug1_7.getEUStored()
- else
- --unable to connect, set to 0
- mfsug1_7EUS = 0
- end
- end
- --mfsug1_8 Check if peripheral is connected
- if mfsug1_8 ~= nil then
- --User value
- mfsug1_8EUS = mfsug1_8.getEUStored()
- else
- --reconnect
- mfsug1_8 = peripheral.wrap(v_mfsug1_8)
- if mfsug1_8 ~= nil then
- --Check if peripheral is connected
- mfsug1_8EUS = mfsug1_8.getEUStored()
- else
- --unable to connect, set to 0
- mfsug1_8EUS = 0
- end
- end
- --mfsug1_9 Check if peripheral is connected
- if mfsug1_9 ~= nil then
- --User value
- mfsug1_9EUS = mfsug1_9.getEUStored()
- else
- --reconnect
- mfsug1_9 = peripheral.wrap(v_mfsug1_9)
- if mfsug1_9 ~= nil then
- --Check if peripheral is connected
- mfsug1_9EUS = mfsug1_9.getEUStored()
- else
- --unable to connect, set to 0
- mfsug1_9EUS = 0
- end
- end
- --mfsug1_10 Check if peripheral is connected
- if mfsug1_10 ~= nil then
- --User value
- mfsug1_10EUS = mfsug1_10.getEUStored()
- else
- --reconnect
- mfsug1_10 = peripheral.wrap(v_mfsug1_10)
- if mfsug1_10 ~= nil then
- --Check if peripheral is connected
- mfsug1_10EUS = mfsug1_10.getEUStored()
- else
- --unable to connect, set to 0
- mfsug1_10EUS = 0
- end
- end
- ----------------------------------------------------------------------------------------------------------------------------------------
- --mfsug2_6 Check if peripheral is connected
- if mfsug2_6 ~= nil then
- --User value
- mfsug2_6EUS = mfsug2_6.getEUStored()
- else
- --reconnect
- mfsug2_6 = peripheral.wrap(v_mfsug2_6)
- if mfsug2_6 ~= nil then
- --Check if peripheral is connected
- mfsug2_6EUS = mfsug2_6.getEUStored()
- else
- --unable to connect, set to 0
- mfsug2_6EUS = 0
- end
- end
- --mfsug2_7 Check if peripheral is connected
- if mfsug2_7 ~= nil then
- --User value
- mfsug2_7EUS = mfsug2_7.getEUStored()
- else
- --reconnect
- mfsug2_7 = peripheral.wrap(v_mfsug2_7)
- if mfsug2_7 ~= nil then
- --Check if peripheral is connected
- mfsug2_7EUS = mfsug2_7.getEUStored()
- else
- --unable to connect, set to 0
- mfsug2_7EUS = 0
- end
- end
- --mfsug2_8 Check if peripheral is connected
- if mfsug2_8 ~= nil then
- --User value
- mfsug2_8EUS = mfsug2_8.getEUStored()
- else
- --reconnect
- mfsug2_8 = peripheral.wrap(v_mfsug2_8)
- if mfsug2_8 ~= nil then
- --Check if peripheral is connected
- mfsug2_8EUS = mfsug2_8.getEUStored()
- else
- --unable to connect, set to 0
- mfsug2_8EUS = 0
- end
- end
- --mfsug2_9 Check if peripheral is connected
- if mfsug2_9 ~= nil then
- --User value
- mfsug2_9EUS = mfsug2_9.getEUStored()
- else
- --reconnect
- mfsug2_9 = peripheral.wrap(v_mfsug2_9)
- if mfsug2_9 ~= nil then
- --Check if peripheral is connected
- mfsug2_9EUS = mfsug2_9.getEUStored()
- else
- --unable to connect, set to 0
- mfsug2_9EUS = 0
- end
- end
- --mfsug2_10 Check if peripheral is connected
- if mfsug2_10 ~= nil then
- --User value
- mfsug2_10EUS = mfsug2_10.getEUStored()
- else
- --reconnect
- mfsug2_10 = peripheral.wrap(v_mfsug2_10)
- if mfsug2_10 ~= nil then
- --Check if peripheral is connected
- mfsug2_10EUS = mfsug2_10.getEUStored()
- else
- --unable to connect, set to 0
- mfsug2_10EUS = 0
- end
- end
- ----------------------------------------------------------------------------------------------------------------------------------------
- --mfsug3_6 Check if peripheral is connected
- if mfsug3_6 ~= nil then
- --User value
- mfsug3_6EUS = mfsug3_6.getEUStored()
- else
- --reconnect
- mfsug3_6 = peripheral.wrap(v_mfsug3_6)
- if mfsug3_6 ~= nil then
- --Check if peripheral is connected
- mfsug3_6EUS = mfsug3_6.getEUStored()
- else
- --unable to connect, set to 0
- mfsug3_6EUS = 0
- end
- end
- --mfsug3_7 Check if peripheral is connected
- if mfsug3_7 ~= nil then
- --User value
- mfsug3_7EUS = mfsug3_7.getEUStored()
- else
- --reconnect
- mfsug3_7 = peripheral.wrap(v_mfsug3_7)
- if mfsug3_7 ~= nil then
- --Check if peripheral is connected
- mfsug3_7EUS = mfsug3_7.getEUStored()
- else
- --unable to connect, set to 0
- mfsug3_7EUS = 0
- end
- end
- --mfsug3_8 Check if peripheral is connected
- if mfsug3_8 ~= nil then
- --User value
- mfsug3_8EUS = mfsug3_8.getEUStored()
- else
- --reconnect
- mfsug3_8 = peripheral.wrap(v_mfsug3_8)
- if mfsug3_8 ~= nil then
- --Check if peripheral is connected
- mfsug3_8EUS = mfsug3_8.getEUStored()
- else
- --unable to connect, set to 0
- mfsug3_8EUS = 0
- end
- end
- --mfsug3_9 Check if peripheral is connected
- if mfsug3_9 ~= nil then
- --User value
- mfsug3_9EUS = mfsug3_9.getEUStored()
- else
- --reconnect
- mfsug3_9 = peripheral.wrap(v_mfsug3_9)
- if mfsug3_9 ~= nil then
- --Check if peripheral is connected
- mfsug3_9EUS = mfsug3_9.getEUStored()
- else
- --unable to connect, set to 0
- mfsug3_9EUS = 0
- end
- end
- --mfsug3_10 Check if peripheral is connected
- if mfsug3_10 ~= nil then
- --User value
- mfsug3_10EUS = mfsug3_10.getEUStored()
- else
- --reconnect
- mfsug3_10 = peripheral.wrap(v_mfsug3_10)
- if mfsug3_10 ~= nil then
- --Check if peripheral is connected
- mfsug3_10EUS = mfsug3_10.getEUStored()
- else
- --unable to connect, set to 0
- mfsug3_10EUS = 0
- end
- end
- mfsu1Perc = math.floor (mfsu1EUS / 40000000 * 100)
- mfsu2Perc = math.floor (mfsu2EUS / 40000000 * 100)
- mfsu3Perc = math.floor (mfsu3EUS / 40000000 * 100)
- mfsu4Perc = math.floor (mfsu4EUS / 40000000 * 100)
- mfsu5Perc = math.floor (mfsu5EUS / 40000000 * 100)
- mfsug1_6Perc = math.floor (mfsug1_6EUS / 40000000 * 100)
- mfsug1_7Perc = math.floor (mfsug1_7EUS / 40000000 * 100)
- mfsug1_8Perc = math.floor (mfsug1_8EUS / 40000000 * 100)
- mfsug1_9Perc = math.floor (mfsug1_9EUS / 40000000 * 100)
- mfsug1_10Perc = math.floor (mfsug1_10EUS / 40000000 * 100)
- mfsu6Perc = math.floor (mfsu6EUS / 40000000 * 100)
- mfsu7Perc = math.floor (mfsu7EUS / 40000000 * 100)
- mfsu8Perc = math.floor (mfsu8EUS / 40000000 * 100)
- mfsu9Perc = math.floor (mfsu9EUS / 40000000 * 100)
- mfsu10Perc = math.floor (mfsu10EUS / 40000000 * 100)
- mfsug2_6Perc = math.floor (mfsug2_6EUS / 40000000 * 100)
- mfsug2_7Perc = math.floor (mfsug2_7EUS / 40000000 * 100)
- mfsug2_8Perc = math.floor (mfsug2_8EUS / 40000000 * 100)
- mfsug2_9Perc = math.floor (mfsug2_9EUS / 40000000 * 100)
- mfsug2_10Perc = math.floor (mfsug2_10EUS / 40000000 * 100)
- mfsu11Perc = math.floor (mfsu11EUS / 40000000 * 100)
- mfsu12Perc = math.floor (mfsu12EUS / 40000000 * 100)
- mfsu13Perc = math.floor (mfsu13EUS / 40000000 * 100)
- mfsu14Perc = math.floor (mfsu14EUS / 40000000 * 100)
- mfsu15Perc = math.floor (mfsu15EUS / 40000000 * 100)
- mfsug3_6Perc = math.floor (mfsug3_6EUS / 40000000 * 100)
- mfsug3_7Perc = math.floor (mfsug3_7EUS / 40000000 * 100)
- mfsug3_8Perc = math.floor (mfsug3_8EUS / 40000000 * 100)
- mfsug3_9Perc = math.floor (mfsug3_9EUS / 40000000 * 100)
- mfsug3_10Perc = math.floor (mfsug3_10EUS / 40000000 * 100)
- m.setCursorPos(43,7) m.write("grp 1")
- m.setCursorPos(43,8) m.write("R1B1 :"..mfsu2Perc.."% ") m.setCursorPos(60,8) m.write("R2B1 :"..mfsu4Perc.."% ")
- m.setCursorPos(43,9) m.write("R1B2 :"..mfsug1_6Perc.."% ") m.setCursorPos(60,9) m.write("R2B2 :"..mfsug1_7Perc.."% ")
- m.setCursorPos(45,10) m.write("GRP1A :"..mfsu5Perc.."% >> ") m.setCursorPos(61,10) m.write("GRP1B :"..mfsug1_10Perc.."% ")
- m.setCursorPos(43,11) m.write("R1A2 :"..mfsug1_8Perc.."% ") m.setCursorPos(60,11) m.write("R2A2 :"..mfsug1_9Perc.."% ")
- m.setCursorPos(43,12) m.write("R1A1 :"..mfsu1Perc.."% ") m.setCursorPos(60,12) m.write("R2A1 :"..mfsu3Perc.."% ")
- m.setCursorPos(43,14) m.write("grp 2")
- m.setCursorPos(43,15) m.write("R3B1 :"..mfsu7Perc.."% ") m.setCursorPos(60,15) m.write("R4B1 :"..mfsu9Perc.."% ")
- m.setCursorPos(43,16) m.write("R3B2 :"..mfsug2_6Perc.."% ") m.setCursorPos(60,16) m.write("R4B2 :"..mfsug2_7Perc.."% ")
- m.setCursorPos(45,17) m.write("GRP3A :"..mfsu10Perc.."% >> ") m.setCursorPos(61,17) m.write("GRP2B :"..mfsug2_10Perc.."% ")
- m.setCursorPos(43,18) m.write("R3A2 :"..mfsug2_8Perc.."% ") m.setCursorPos(60,18) m.write("R4A2 :"..mfsug2_9Perc.."% ")
- m.setCursorPos(43,19) m.write("R3A1 :"..mfsu6Perc.."% ") m.setCursorPos(60,19) m.write("R4A1 :"..mfsu8Perc.."% ")
- m.setCursorPos(43,21) m.write("grp 3")
- m.setCursorPos(43,22) m.write("R5B1 :"..mfsu12Perc.."% ") m.setCursorPos(60,22) m.write("R6B1 :"..mfsu14Perc.."% ")
- m.setCursorPos(43,23) m.write("R5B2 :"..mfsug3_6Perc.."% ") m.setCursorPos(60,23) m.write("R6B2 :"..mfsug3_7Perc.."% ")
- m.setCursorPos(45,24) m.write("GRP3A :"..mfsu15Perc.."% >> ") m.setCursorPos(61,24) m.write("GRP2B :"..mfsug3_10Perc.."% ")
- m.setCursorPos(43,25) m.write("R5A2 :"..mfsug3_8Perc.."% ") m.setCursorPos(60,25) m.write("R6A2 :"..mfsug3_9Perc.."% ")
- m.setCursorPos(43,26) m.write("R5A1 :"..mfsu11Perc.."% ") m.setCursorPos(60,26) m.write("R6A1 :"..mfsu13Perc.."% ")
- sleep(1)
- end
- end
- function LiquidTanksAll()
- tank1 = peripheral.wrap(rfp1)
- tank2 = peripheral.wrap(rfp2)
- tank3 = peripheral.wrap(rfp3)
- tank4 = peripheral.wrap(rfp4)
- tank5 = peripheral.wrap(rfp5)
- tank6 = peripheral.wrap(rfp6)
- EmptyCounter1 = 0
- EmptyCounter2 = 0
- EmptyCounter3 = 0
- EmptyCounter4 = 0
- EmptyCounter5 = 0
- EmptyCounter6 = 0
- while true do
- m.setCursorPos(45,1)
- tank1I = tank1.getTankInfo()
- tank2I = tank2.getTankInfo()
- tank3I = tank3.getTankInfo()
- tank4I = tank4.getTankInfo()
- tank5I = tank5.getTankInfo()
- tank6I = tank6.getTankInfo()
- -- begin Reactor 1
- if tank1I[1]["contents"] == nil then
- EmptyCounter1 = EmptyCounter1 + 1
- ic2c1ValueC = "0"
- else
- EmptyCounter1 = 0
- if tank1I[1]["contents"]["name"] == "ic2coolant" then
- ic2c1 = tank1I[1]
- ic2c1ValueC = ic2c1["contents"]["amount"]
- elseif tank1I[1]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc1 = tank1I[1]
- ic2hc1ValueC = ic2hc1["contents"]["amount"]
- else
- error("R1 Incorrect liquid in "..tank1I[1]["contents"]["name"])
- end
- if tank1I[2]["contents"] ~= nil then
- if tank1I[2]["contents"]["name"] == "ic2coolant" then
- ic2c1 = tank1I[2]
- ic2c1ValueC = ic2c1["contents"]["amount"]
- elseif tank1I[2]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc1 = tank1I[2]
- ic2hc1ValueC = ic2hc1["contents"]["amount"]
- else
- error("R1 Incorrect liquid in "..tank1I[1]["contents"]["name"])
- end
- else
- ic2hc1ValueC = "0"
- end
- --R1
- x1 = ic2c1ValueC / 10000 * 100
- m.setCursorPos(22,2) m.setBackgroundColor(colors.cyan)
- if x1 < 50 then
- m.write("warning!! Coolant LOW :"..math.floor(x1).."% full.....")
- else
- m.write("C : "..math.floor(x1).."% full")
- end
- m.setBackgroundColor(colors.black)
- y1 = ic2hc1ValueC / 10000 * 100
- m.setCursorPos(22,4) m.setBackgroundColor(colors.red)
- if y1 > 50 then
- m.write("warning!! HC HIGH :"..math.floor(y1).."% full.....")
- else
- -- m.write("HC : "..math.floor(y1).."% full")
- m.write("HC : "..ic2hc1ValueC.." full.....")
- end
- m.setBackgroundColor(colors.black)
- -- sleep(0.5)
- end
- -- end Reactor 1
- -- begin Reactor 2
- if tank2I[1]["contents"] == nil then
- EmptyCounter2 = EmptyCounter2 + 1
- ic2c2ValueC = "0"
- else
- EmptyCounter2 = 0
- if tank2I[1]["contents"]["name"] == "ic2coolant" then
- ic2c2 = tank2I[1]
- ic2c2ValueC = ic2c2["contents"]["amount"]
- elseif tank2I[1]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc2 = tank2I[1]
- ic2hc2ValueC = ic2hc2["contents"]["amount"]
- else
- error("R2 Incorrect liquid in "..tank2I[1]["contents"]["name"])
- end
- if tank2I[2]["contents"] ~= nil then
- if tank2I[2]["contents"]["name"] == "ic2coolant" then
- ic2c2 = tank2I[2]
- ic2c2ValueC = ic2c2["contents"]["amount"]
- elseif tank2I[2]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc2 = tank2I[2]
- ic2hc2ValueC = ic2hc2["contents"]["amount"]
- else
- error("R2 Incorrect liquid in "..tank2I[1]["contents"]["name"])
- end
- else
- ic2hc2ValueC = "0"
- end
- --R2
- x2 = ic2c2ValueC / 20000 * 200
- m.setCursorPos(22,6) m.setBackgroundColor(colors.cyan)
- if x2 < 50 then
- m.write("warning!! Coolant LOW :"..math.floor(x2).."% full.....")
- else
- m.write("C : "..math.floor(x2).."% full")
- end
- m.setBackgroundColor(colors.black)
- y2 = ic2hc2ValueC / 20000 * 200
- m.setCursorPos(22,8) m.setBackgroundColor(colors.red)
- if y2 > 50 then
- m.write("warning!! HC HIGH :"..math.floor(y2).."% full.....")
- else
- -- m.write("HC : "..math.floor(y2).."% full")
- m.write("HC : "..ic2hc2ValueC.." full.....")
- end
- m.setBackgroundColor(colors.black)
- -- sleep(0.5)
- end
- -- end Reactor 2
- -- begin Reactor 3
- if tank3I[1]["contents"] == nil then
- EmptyCounter3 = EmptyCounter3 + 1
- ic2c3ValueC = "0"
- else
- EmptyCounter3 = 0
- if tank3I[1]["contents"]["name"] == "ic2coolant" then
- ic2c3 = tank3I[1]
- ic2c3ValueC = ic2c3["contents"]["amount"]
- elseif tank3I[1]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc3 = tank3I[1]
- ic2hc3ValueC = ic2hc3["contents"]["amount"]
- else
- error("R3 Incorrect liquid in "..tank3I[1]["contents"]["name"])
- end
- if tank3I[2]["contents"] ~= nil then
- if tank3I[2]["contents"]["name"] == "ic2coolant" then
- ic2c3 = tank3I[2]
- ic2c3ValueC = ic2c3["contents"]["amount"]
- elseif tank3I[2]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc3 = tank3I[2]
- ic2hc3ValueC = ic2hc3["contents"]["amount"]
- else
- error("R3 Incorrect liquid in "..tank3I[1]["contents"]["name"])
- end
- else
- ic2hc3ValueC = "0"
- end
- --R3
- x3 = ic2c3ValueC / 30000 * 300
- m.setCursorPos(22,10) m.setBackgroundColor(colors.cyan)
- if x3 < 50 then
- m.write("warning!! Coolant LOW :"..math.floor(x3).."% full.....")
- else
- m.write("C : "..math.floor(x3).."% full")
- end
- m.setBackgroundColor(colors.black)
- y3 = ic2hc3ValueC / 30000 * 300
- m.setCursorPos(22,12) m.setBackgroundColor(colors.red)
- if y3 > 50 then
- m.write("warning!! HC HIGH :"..math.floor(y3).."% full.....")
- else
- -- m.write("HC : "..math.floor(y3).."% full")
- m.write("HC : "..ic2hc3ValueC.." full.....")
- end
- m.setBackgroundColor(colors.black)
- -- sleep(0.5)
- end
- -- end Reactor 3
- -- begin Reactor 4
- if tank4I[1]["contents"] == nil then
- EmptyCounter4 = EmptyCounter4 + 1
- ic2c4ValueC = "0"
- else
- EmptyCounter4 = 0
- if tank4I[1]["contents"]["name"] == "ic2coolant" then
- ic2c4 = tank4I[1]
- ic2c4ValueC = ic2c4["contents"]["amount"]
- elseif tank4I[1]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc4 = tank4I[1]
- ic2hc4ValueC = ic2hc4["contents"]["amount"]
- else
- error("R4 Incorrect liquid in "..tank4I[1]["contents"]["name"])
- end
- if tank4I[2]["contents"] ~= nil then
- if tank4I[2]["contents"]["name"] == "ic2coolant" then
- ic2c4 = tank4I[2]
- ic2c4ValueC = ic2c4["contents"]["amount"]
- elseif tank4I[2]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc4 = tank4I[2]
- ic2hc4ValueC = ic2hc4["contents"]["amount"]
- else
- error("R4 Incorrect liquid in "..tank4I[1]["contents"]["name"])
- end
- else
- ic2hc4ValueC = "0"
- end
- --R4
- x4 = ic2c4ValueC / 40000 * 400
- m.setCursorPos(22,14) m.setBackgroundColor(colors.cyan)
- if x4 < 50 then
- m.write("warning!! Coolant LOW :"..math.floor(x4).."% full.....")
- else
- m.write("C : "..math.floor(x4).."% full")
- end
- m.setBackgroundColor(colors.black)
- y4 = ic2hc4ValueC / 40000 * 400
- m.setCursorPos(22,16) m.setBackgroundColor(colors.red)
- if y4 > 50 then
- m.write("warning!! HC HIGH :"..math.floor(y4).."% full.....")
- else
- -- m.write("HC : "..math.floor(y4).."% full")
- m.write("HC : "..ic2hc4ValueC.." full.....")
- end
- m.setBackgroundColor(colors.black)
- -- sleep(0.5)
- end
- -- end Reactor 4
- -- begin Reactor 5
- if tank5I[1]["contents"] == nil then
- EmptyCounter5 = EmptyCounter5 + 1
- ic2c5ValueC = "0"
- elseif tank5I[2] == nil then
- EmptyCounter5 = EmptyCounter5 + 1
- else
- EmptyCounter5 = 0
- if tank5I[1]["contents"]["name"] == "ic2coolant" then
- ic2c5 = tank5I[1]
- ic2c5ValueC = ic2c5["contents"]["amount"]
- elseif tank5I[1]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc5 = tank5I[1]
- ic2hc5ValueC = ic2hc5["contents"]["amount"]
- else
- error("R5 Incorrect liquid in "..tank5I[1]["contents"]["name"])
- end
- if tank5I[2]["contents"] ~= nil then
- if tank5I[2]["contents"]["name"] == "ic2coolant" then
- ic2c5 = tank5I[2]
- ic2c5ValueC = ic2c5["contents"]["amount"]
- elseif tank5I[2]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc5 = tank5I[2]
- ic2hc5ValueC = ic2hc5["contents"]["amount"]
- else
- error("R5 Incorrect liquid in "..tank5I[1]["contents"]["name"])
- end
- else
- ic2hc5ValueC = "0"
- end
- --R5
- x5 = ic2c5ValueC / 50000 * 500
- m.setCursorPos(22,18) m.setBackgroundColor(colors.cyan)
- if x5 < 50 then
- m.write("warning!! Coolant LOW :"..math.floor(x5).."% full.....")
- else
- m.write("C : "..math.floor(x5).."% full")
- end
- m.setBackgroundColor(colors.black)
- y5 = ic2hc5ValueC / 50000 * 500
- m.setCursorPos(22,20) m.setBackgroundColor(colors.red)
- if y5 > 50 then
- m.write("warning!! HC HIGH :"..math.floor(y5).."% full.....")
- else
- -- m.write("HC : "..math.floor(y5).."% full")
- m.write("HC : "..ic2hc5ValueC.." full.....")
- end
- m.setBackgroundColor(colors.black)
- -- sleep(0.5)
- end
- -- end Reactor 5
- -- begin Reactor 6
- if tank6I[1]["contents"] == nil then
- EmptyCounter6 = EmptyCounter6 + 1
- ic2c6ValueC = "0"
- elseif tank6I[2] == nil then
- EmptyCounter6 = EmptyCounter6 + 1
- else
- EmptyCounter6 = 0
- if tank6I[1]["contents"]["name"] == "ic2coolant" then
- ic2c6 = tank6I[1]
- ic2c6ValueC = ic2c6["contents"]["amount"]
- elseif tank6I[1]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc6 = tank6I[1]
- ic2hc6ValueC = ic2hc6["contents"]["amount"]
- else
- error("R6 Incorrect liquid in "..tank6I[1]["contents"]["name"])
- end
- if tank6I[2]["contents"] ~= nil then
- if tank6I[2]["contents"]["name"] == "ic2coolant" then
- ic2c6 = tank6I[2]
- ic2c6ValueC = ic2c6["contents"]["amount"]
- elseif tank6I[2]["contents"]["name"] == "ic2hotcoolant" then
- ic2hc6 = tank6I[2]
- ic2hc6ValueC = ic2hc6["contents"]["amount"]
- else
- error("R6 Incorrect liquid in "..tank6I[1]["contents"]["name"])
- end
- else
- ic2hc6ValueC = "0"
- end
- --R6
- x6 = ic2c6ValueC / 60000 * 600
- m.setCursorPos(22,22) m.setBackgroundColor(colors.cyan)
- if x6 < 60 then
- m.write("warning!! Coolant LOW :"..math.floor(x6).."% full.....")
- else
- m.write("C : "..math.floor(x6).."% full")
- end
- m.setBackgroundColor(colors.black)
- y6 = ic2hc6ValueC / 60000 * 600
- m.setCursorPos(22,24) m.setBackgroundColor(colors.red)
- if y6 > 60 then
- m.write("warning!! HC HIGH :"..math.floor(y6).."% full.....")
- else
- -- m.write("HC : "..math.floor(y6).."% full")
- m.write("HC : "..ic2hc6ValueC.." full.....")
- end
- m.setBackgroundColor(colors.black)
- -- sleep(0.6)
- end
- -- end Reactor 6
- sleep(1)
- end
- end
- function fillTable()
- button.setTable("Reactor1",Reactor1,2,15,2,4)
- button.setTable("Reactor2",Reactor2,2,15,6,8)
- button.setTable("Reactor3",Reactor3,2,15,10,12)
- button.setTable("Reactor4",Reactor4,2,15,14,16)
- button.setTable("Reactor5",Reactor5,2,15,18,20)
- button.setTable("Reactor6",Reactor6,2,15,22,24)
- button.setTable("Turn Off ALL",TurnOffALL,2,15,26,28)
- button.screen()
- end
- function listen()
- while true do
- local senderIdL1, messageL1, protocolL1 = rednet.receive("rc1",3)
- local senderIdL2, messageL2, protocolL2 = rednet.receive("rc2",3)
- local senderIdL3, messageL3, protocolL3 = rednet.receive("rc3",3)
- local senderIdL4, messageL4, protocolL4 = rednet.receive("rc4",3)
- local senderIdL5, messageL5, protocolL5 = rednet.receive("rc5",3)
- local senderIdL6, messageL6, protocolL6 = rednet.receive("rc6",3)
- if vML1rgA ~= nil then
- print("message from RC1:"..vML1rgA)
- vRG1A = vML1rgA
- else
- xm1 = xm1 + 1
- print("Got no message from RC1 ("..xm1..")")
- end
- if messageL1 ~= nil then
- print("message from RC1:"..messageL1)
- R1OnOff = messageL1
- else
- xm1 = xm1 + 1
- print("Got no message from RC1 ("..xm1..")")
- end
- if messageL2 ~= nil then
- print("message from RC2:"..messageL2)
- R2OnOff = messageL2
- else
- xm2 = xm2 + 1
- print("Got no message from RC2 ("..xm2..")")
- end
- if messageL3 ~= nil then
- -- print("message from RC3:"..messageL3)
- R3OnOff = messageL3
- else
- xm3 = xm3 + 1
- print("Got no message from RC3 ("..xm3..")")
- end
- if messageL4 ~= nil then
- -- print("message from RC4:"..messageL4)
- R4OnOff = messageL4
- else
- xm4 = xm4 + 1
- print("Got no message from RC4 ("..xm4..")")
- end
- if messageL5 ~= nil then
- -- print("message from RC5:"..messageL5)
- R5OnOff = messageL5
- else
- xm5 = xm5 + 1
- print("Got no message from RC5 ("..xm5..")")
- end
- if messageL6 ~= nil then
- -- print("message from RC6:"..messageL6)
- R6OnOff = messageL6
- else
- xm6 = xm6 + 1
- print("Got no message from RC6 ("..xm4..")")
- end
- sleep(0,5)
- end
- end
- function urs()
- --Update Reactor status
- -- listenx = 1
- while true do
- -- print("R1OnOff:"..R1OnOff)
- -- print("R2OnOff:"..R2OnOff)
- -- print("R3OnOff:"..R3OnOff)
- -- print("R4OnOff:"..R4OnOff)
- -- print("R5OnOff:"..R5OnOff)
- -- print("R6OnOff:"..R6OnOff)
- if R1OnOff == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(18,3) m.write("Off")
- m.setBackgroundColor(colors.black)
- elseif R1OnOff == "On" then
- m.setBackgroundColor(colors.green)
- m.setCursorPos(18,3) m.write("On ")
- m.setBackgroundColor(colors.black)
- elseif R1OnOff == "mOn" then
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(18,3) m.write("mOn")
- m.setBackgroundColor(colors.black)
- elseif R1OnOff == "NUL" then
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(18,3) m.write("NUL")
- m.setBackgroundColor(colors.black)
- end
- if R2OnOff == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(18,7) m.write("Off")
- m.setBackgroundColor(colors.black)
- elseif R2OnOff == "On" then
- m.setBackgroundColor(colors.green)
- m.setCursorPos(18,7) m.write("On ")
- m.setBackgroundColor(colors.black)
- elseif R2OnOff == "mOn" then
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(18,7) m.write("mOn")
- m.setBackgroundColor(colors.black)
- elseif R2OnOff == "NUL" then
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(18,7) m.write("NUL")
- m.setBackgroundColor(colors.black)
- end
- if R3OnOff == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(18,11) m.write("Off")
- m.setBackgroundColor(colors.black)
- elseif R3OnOff == "On" then
- m.setBackgroundColor(colors.green)
- m.setCursorPos(18,11) m.write("On ")
- m.setBackgroundColor(colors.black)
- elseif R3OnOff == "mOn" then
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(18,11) m.write("mOn")
- m.setBackgroundColor(colors.black)
- elseif R3OnOff == "NUL" then
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(18,11) m.write("NUL")
- m.setBackgroundColor(colors.black)
- end
- if R4OnOff == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(18,15) m.write("Off")
- m.setBackgroundColor(colors.black)
- elseif R4OnOff == "On" then
- m.setBackgroundColor(colors.green)
- m.setCursorPos(18,15) m.write("On ")
- m.setBackgroundColor(colors.black)
- elseif R4OnOff == "mOn" then
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(18,15) m.write("mOn")
- m.setBackgroundColor(colors.black)
- elseif R4OnOff == "NUL" then
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(18,15) m.write("NUL")
- m.setBackgroundColor(colors.black)
- end
- if R5OnOff == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(18,19) m.write("Off")
- m.setBackgroundColor(colors.black)
- elseif R5OnOff == "On" then
- m.setBackgroundColor(colors.green)
- m.setCursorPos(18,19) m.write("On ")
- m.setBackgroundColor(colors.black)
- elseif R5OnOff == "mOn" then
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(18,19) m.write("mOn")
- m.setBackgroundColor(colors.black)
- elseif R5OnOff == "NUL" then
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(18,19) m.write("NUL")
- m.setBackgroundColor(colors.black)
- end
- if R6OnOff == "Off" then
- m.setBackgroundColor(colors.red)
- m.setCursorPos(18,23) m.write("Off")
- m.setBackgroundColor(colors.black)
- elseif R6OnOff == "On" then
- m.setBackgroundColor(colors.green)
- m.setCursorPos(18,23) m.write("On ")
- m.setBackgroundColor(colors.black)
- elseif R6OnOff == "mOn" then
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(18,23) m.write("mOn")
- m.setBackgroundColor(colors.black)
- elseif R6OnOff == "NUL" then
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(18,23) m.write("NUL")
- m.setBackgroundColor(colors.black)
- end
- sleep(0,5)
- end
- end
- function R1On()
- print("Button 1 doet niets")
- end
- function R2On()
- print("Button 2 doet niets")
- end
- function R3On()
- print("Button 3 doet niets")
- end
- function R4On()
- print("Button 4 doet niets")
- end
- function R5On()
- print("Button 5 doet niets")
- end
- function R6On()
- print("Button 6 doet niets")
- end
- function getClick()
- while true do
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x, y)
- end
- end
- function pulse()
- redstone.setOutput("back", true)
- sleep(0,5)
- redstone.setOutput("back", false)
- end
- function Reactor1()
- rednet.send(rc1,"TOR1","rctrl")
- button.flash("Reactor1")
- end
- function Reactor2()
- rednet.send(rc2,"TOR2","rctrl")
- button.flash("Reactor2")
- end
- function Reactor3()
- rednet.send(rc3,"TOR3","rctrl")
- button.flash("Reactor3")
- end
- function Reactor4()
- rednet.send(rc4,"TOR4","rctrl")
- button.flash("Reactor4")
- end
- function Reactor5()
- rednet.send(rc5,"TOR5","rctrl")
- button.flash("Reactor5")
- end
- function Reactor6()
- rednet.send(rc6,"TOR6","rctrl")
- button.flash("Reactor6")
- end
- function TurnOffALL()
- Reactor1()
- Reactor2()
- Reactor3()
- Reactor4()
- Reactor5()
- Reactor6()
- end
- fillTable()
- m.setCursorPos(43,6)
- m.write("----------------------------------------------------------------")
- x1=0
- while true do
- -- x1=x1 + 1
- parallel.waitForAny(urs, listen, getClick , LiquidTanksAll, mfsuAll, rgCheck)
- print("sleep:"..x1)
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement