2 posts
Posted 26 January 2015 - 11:58 AM
So I'm writing a computercraft program similar to what DW20 did on forgecraft, except I'm trying to write so that I can expand it to more than one turbine/reactor when I'm ready to do so. The only real issue I'm running into right now is that in DW20's code he uses a method capacitor.getMaxEnergyStored(), but when I use that same method my program hangs up and doesn't proceed.
Here is a copy of my code so far: pastebin.com/2wAe78CT
The block of code between lines 246 and 250 are where the program freezes up. the print("test") on line 246 shows up fine, but the other prints after that do not.
Anyone know whats going on?
7083 posts
Location
Tasmania (AU)
Posted 27 January 2015 - 01:22 AM
When you say "freezes", I assume that means it hangs there indefinitely, without ever crashing out, clearing the screen, or writing error messages? That'd suggest the peripheral call (made to the "capacitor bank", whatever that is) is waiting for a certain event to fire, but never catching it for some reason.
Just for giggles, perhaps try a sleep(1) immediately after print("test"). You could also try hard-coding the value (go to the capacitor bank thingy yourself, work out how much energy it can hold, then plug that number into the script in place of capacitor.getMaxEnergyStored() - though obviously that's inelegant).
2 posts
Posted 27 January 2015 - 09:21 AM
When you say "freezes", I assume that means it hangs there indefinitely, without ever crashing out, clearing the screen, or writing error messages?
That's exactly what happens.
Just for giggles, perhaps try a sleep(1) immediately after print("test").
I tried this in a test script, but get the same result.