Posted 16 January 2013 - 10:59 AM
Firstly, I wasn't sure where to post this, so apologies if it's in the wrong place. I'm not sure if it's just bad coding causing the crash or not, sooo. (Noob here.)
Secondly, I'm using the Direwolf20 pack on the FTB launcher.
What I'm trying to do is use the misc peripherals mod to detect when a redstone energy cell is full via the gate reader block. The code works fine when it is run outside of a loop, but fails to detect any change if a redstone energy cell is to lose energy, become full, etc. On occasion, when the cell was originally 'not full', and I replace it with a full one, and then enter the computer interface to see what's happening, the game will crash. I saved the code as "startup" so it runs right away, but even without this, the same problems occur.
The code:
If I should be asking this on a different forum, I am sorry. I'd appreciate it if you could point me in the right direction. But if anyone knows what I'm doing wrong, please tell me what it is.
Also, if it's any help, the output will always read Full! or Not Full! depending on what is true when the code first runs, but this will not change, even if the energy cell's charge does.
Secondly, I'm using the Direwolf20 pack on the FTB launcher.
What I'm trying to do is use the misc peripherals mod to detect when a redstone energy cell is full via the gate reader block. The code works fine when it is run outside of a loop, but fails to detect any change if a redstone energy cell is to lose energy, become full, etc. On occasion, when the cell was originally 'not full', and I replace it with a full one, and then enter the computer interface to see what's happening, the game will crash. I saved the code as "startup" so it runs right away, but even without this, the same problems occur.
The code:
local m = peripheral.wrap("front")
local data
local dfull
local x = 0
data = m.get()
dfull = data["Full Energy"]
while x == 0 do
if dfull then
print("Full!")
redstone.setOutput("back", true)
sleep(10)
else
print("Not Full!")
redstone.setOutput("back", false)
sleep(2)
end
end
If I should be asking this on a different forum, I am sorry. I'd appreciate it if you could point me in the right direction. But if anyone knows what I'm doing wrong, please tell me what it is.
Also, if it's any help, the output will always read Full! or Not Full! depending on what is true when the code first runs, but this will not change, even if the energy cell's charge does.