local reactor1 = peripheral.wrap("BigReactors-Reactor_1")
local turbine1 = peripheral.wrap("BigReactors-Turbine_1")
local reactor2 = peripheral.wrap("BigReactors-Reactor_2")
local turbine2 = peripheral.wrap("BigReactors-Turbine_2")
local ec1 = peripheral.wrap("cofh_thermalexpansion_energycell_0")
local mon1 = peripheral.wrap("left")
local mon2 = peripheral.wrap("right")
while true do
sleep(0.5)
mon1.clear()
mon1.setTextScale(0.5)
mon2.clear()
mon2.setTextScale(0.5)
mon1.setCursorPos(1,1)
mon1.setTextColor(colors.white)
mon1.write("Reactor: ")
if reactor1.getActive (true) then
mon1.setTextColor(colors.lime)
mon1.write("Online")
redstone.setOutput ("top",false)
else
mon1.setTextColor(colors.red)
mon1.write("Offline")
redstone.setOutput ("top",true)
end
mon1.setCursorPos(1,2)
mon1.setTextColor(colors.white)
mon1.write("Turbine: ")
if turbine1.getActive (true) then
mon1.setTextColor(colors.lime)
mon1.write("Online")
redstone.setOutput ("top",false)
else
mon1.setTextColor(colors.red)
mon1.write("Offline")
redstone.setOutput ("top",true)
end
mon1.setCursorPos(1,4)
mon1.setTextColor(colors.white)
mon1.write("Power (RF/T): ")
mon1.setTextColor(colors.lime)
mon1.write(turbine1.getEnergyProducedLastTick())
mon1.setCursorPos(1,5)
mon1.setTextColor(colors.white)
mon1.write("Stored RF: ")
mon1.setTextColor(colors.lime)
mon1.write(turbine1.getEnergyStored())
mon1.setCursorPos(1,6)
mon1.setTextColor(colors.white)
mon1.write("Rotor Speed (RPM): ")
mon1.setTextColor(colors.lime)
mon1.write(turbine1.getRotorSpeed())
mon2.setCursorPos(1,1)
mon2.setTextColor(colors.white)
mon2.write("Reactor: ")
if reactor2.getActive (true) then
mon2.setTextColor(colors.lime)
mon2.write("Online")
redstone.setOutput ("top",false)
else
mon2.setTextColor(colors.red)
mon2.write("Offline")
redstone.setOutput ("top",true)
end
mon2.setCursorPos(1,2)
mon2.setTextColor(colors.white)
mon2.write("Turbine: ")
if turbine2.getActive (true) then
mon2.setTextColor(colors.lime)
mon2.write("Online")
redstone.setOutput ("top",false)
else
mon2.setTextColor(colors.red)
mon2.write("Offline")
redstone.setOutput ("top",true)
end
mon2.setCursorPos(1,4)
mon2.setTextColor(colors.white)
mon2.write("Power (RF/T):")
mon2.setTextColor(colors.lime)
mon2.write(turbine2.getEnergyProducedLastTick())
mon2.setCursorPos(1,5)
mon2.setTextColor(colors.white)
mon2.write("Stored RF: ")
mon2.setTextColor(colors.lime)
mon2.write(turbine2.getEnergyStored())
mon2.setCursorPos(1,6)
mon2.setTextColor(colors.white)
mon2.write("Rotor Speed (RPM): ")
mon2.setTextColor(colors.lime)
mon2.write(turbine2.getRotorSpeed())
end
Redstone signal not emmiting
Started by HMJonesy, Sep 08 2014 12:21 AM
2 replies to this topic
#1
Posted 08 September 2014 - 12:21 AM
Here is the code ive been working on, it all works fine apart from redstone signal only emits if turbine 2 is offline and not when any of them go offline. could you please have a look and see what ive done wrong
#2
Posted 08 September 2014 - 07:56 AM
it's not so much that it is only turning it on if turbine 2 is offline, it's that if reactor 2 is online, it turns the signal back off again when the code gets to there. There a couple of options to how you could fix this. but my suggestion would be to have 2 booleans, turbine1active and turbine2active which are set to true or false instead of the redstone output. then at the very end of the loop do something like:
Additionally, you could make your code much more compact if you used tables to store your peripherals, so instead of mon1, mon2 you have mon[1] and mon[2], that way you could just loop through your sensing/display code twice, with "for i=1,2 do"
hope this helps
if turbine1active or turbine2active then
rs.setOutput("top",false)
else
rs.setOutput("top", true)
end
Additionally, you could make your code much more compact if you used tables to store your peripherals, so instead of mon1, mon2 you have mon[1] and mon[2], that way you could just loop through your sensing/display code twice, with "for i=1,2 do"
hope this helps
Edited by hilburn, 08 September 2014 - 07:57 AM.
#3
Posted 08 September 2014 - 10:37 AM
this is my first ever code so will take me some time to work it out, but ill defo look into tables.
Cheers for the info
Cheers for the info
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











