Posted 09 December 2013 - 01:46 PM
Here is my code and im a super NOOB at this so i apologise to everyone for any mistakes ill make.
os.loadAPI("ocs/apis/sensor")
–Wrap Monitor
local mon = peripheral.wrap("monitor_11")
–Find Sensor
local sense = sensor.wrap("top")
–Redirect to Monitor
term.redirect(mon)
–Info Check
function updateheat()
local reactorData = sense.getTargetDetails("1,2,0")
end
–Monitor Update
function updatemon()
term.clear()
term.setCursorPos(1,1)
local reactorData = sense.getTargetDetails("1,2,0")
print(reactorData.HeatPercentage)
sleep(1)
end
–Reactor Control
–This is my Problem!!!
function reactor()
if reactorData.HeatPercentage < 2 then
rs.setOutput("back", true)
end
if reactorData.HeatPercentage > 50 then
rs.setOutput("back", false)
end
end
while true do
updateheat()
updatemon()
reactor()
end
so the purpose of this is to keep the reactor from reaching a critical heat level say around 70% of total heat but keep it running till then my problem is getting a conditional statement to do so.
http://pastebin.com/4hTBMQN1
Spoiler
–Load Sensor APIos.loadAPI("ocs/apis/sensor")
–Wrap Monitor
local mon = peripheral.wrap("monitor_11")
–Find Sensor
local sense = sensor.wrap("top")
–Redirect to Monitor
term.redirect(mon)
–Info Check
function updateheat()
local reactorData = sense.getTargetDetails("1,2,0")
end
–Monitor Update
function updatemon()
term.clear()
term.setCursorPos(1,1)
local reactorData = sense.getTargetDetails("1,2,0")
print(reactorData.HeatPercentage)
sleep(1)
end
–Reactor Control
–This is my Problem!!!
function reactor()
if reactorData.HeatPercentage < 2 then
rs.setOutput("back", true)
end
if reactorData.HeatPercentage > 50 then
rs.setOutput("back", false)
end
end
while true do
updateheat()
updatemon()
reactor()
end
so the purpose of this is to keep the reactor from reaching a critical heat level say around 70% of total heat but keep it running till then my problem is getting a conditional statement to do so.
http://pastebin.com/4hTBMQN1