Posted 31 March 2018 - 06:08 PM
Hi. I've been working on this bare-bones reactor control that shuts off the reactor when the heat value exceeds 7000. I'm very new to programming and I am only familiar with the basics and I can't seem to get my code to work. My setup is an advanced computer with a wired modem in the back connecting it to a nuclear reactor with a wired modem.
The sleep(0) was added to remove a "too long without yielding" error; however, even though there isn't an error the code does not seem to function properly. For example, when I begin the program and the reactor heat is 0 and then run it until the heat is at 7000, the computer will still output a redstone signal. Similarly, if I start the program when the reactor heat is above 7000 and I cool the reactor to a heat level below 7000, then the redstone signal will not change and there will be no output. I believe this has something to do with the "too long without yielding" error, but I do not know how to fix the error without using the sleep command. Thank you for your patience!
nuke = peripheral.wrap("back")
heat = nuke.callRemote("nuclear_reactor_0","getHeat")
while true do
while heat < 7000 do
rs.setOutput("right",true)
sleep(0)
end
end
The sleep(0) was added to remove a "too long without yielding" error; however, even though there isn't an error the code does not seem to function properly. For example, when I begin the program and the reactor heat is 0 and then run it until the heat is at 7000, the computer will still output a redstone signal. Similarly, if I start the program when the reactor heat is above 7000 and I cool the reactor to a heat level below 7000, then the redstone signal will not change and there will be no output. I believe this has something to do with the "too long without yielding" error, but I do not know how to fix the error without using the sleep command. Thank you for your patience!