Posted 20 April 2018 - 11:18 AM
Hello, I'm pretty now to ComputerCraft so please excuse any dumb mistakes I make. I've been trying to expand upon a simple BigReactos script I found here that simply turns the reactor on when below a certain threshold then turns it back off once it reaches another, large threshold. Initially I wanted to set it up such that I had 3 different thresholds. One at a very low value that would go off and kick the reactor into high gear, another that would turn it down a bit once it had some buffer room in the internal RF storage and the final value it stays at until it fills at which point it turns off.
What I have here is a shell of that. My first question is if there is some screwy issue with BigReactors where it gives the internal readings of the RF levels wrong? It would repeatedly think that the interna; RF was above my second threshold, skipping the lowest internal level, highest level of power generation. I was forced to only create 3 conditions instead of 4 which was what I have below. If that was unclear I'm sorry, it's 3:30 AM and I've been working on this for hours. My more relevant question is trying to fix an issue with my current program where it's getting a "too long without yielding" error. I read around about "sleep" and someone suggested a fake "event call" both of which are seen below. Neither of which fixed the program. That is my more relevant question. Thanks in advance!
What I have here is a shell of that. My first question is if there is some screwy issue with BigReactors where it gives the internal readings of the RF levels wrong? It would repeatedly think that the interna; RF was above my second threshold, skipping the lowest internal level, highest level of power generation. I was forced to only create 3 conditions instead of 4 which was what I have below. If that was unclear I'm sorry, it's 3:30 AM and I've been working on this for hours. My more relevant question is trying to fix an issue with my current program where it's getting a "too long without yielding" error. I read around about "sleep" and someone suggested a fake "event call" both of which are seen below. Neither of which fixed the program. That is my more relevant question. Thanks in advance!
term.clear()
reactor = peripheral.wrap("BigReactors-Reactor_0")
term.setCursorPos(1,2)
write("----------Reactor Generation Status----------")
while true do
energy = reactor.getEnergyStored()
if energy < 10000000 then
reactor.setActive (true)
term.setCursorPos(1,1)
term.clearLine()
write("Energy buffer below 3,000,000, reactor active")
if energy < 1000000 then
reactor.setAllControlRodLevels(30)
term.setCursorPos(1,3)
term.clearLine()
write("RF buffer low. Increasing power generation.")
sleep(10)
os.queueEvent("We Yield For No One!");
os.pullEvent();
end
else
reactor.setAllControlRodLevels(80)
term.setCursorPos(1,3)
term.clearLine()
write("RF buffer nominal. Setting normal power generation.")
sleep(10)
os.queueEvent("We Yield For No One!");
os.pullEvent();
end
end
if energy >= 10000000 then
reactor.setActive (false)
term.setCursorPos(1,1)
term.clearLine()
write("Energy buffer at 4 million, hibernating reactor")
term.setCursorPos(1,3)
term.clearLine()
write("Reactor Inactive")
sleep(10)
os.queueEvent("We Yield For No One!");
os.pullEvent();
end