Posted 20 March 2014 - 01:15 AM
hi, i am playing the direwolf20 ftb pack, and i wanted to control a solar generator with a computer. the generator has two modes: charging and releasing, and it switches between them on a redstone signal. i wrote a program that i hope will take care of this for me, but i am unsure if it will run like i want it to. i want it to check if the energy is full (500000) then set the redstone output on the generators side to true, then print the energy and wait a bit before trying agian. then when it is fully drained i want it to turn off the redstone output and do the same "print, wait" setup as the other loop. my problem is i dont know if it will keep looping like i want it to, but i dont have the time to fully test this as it takes a long time, so i was wondering if you could take a look at it and tell me if it wold work and if you see any glaring errors, thanks!
also please tell me how my indenting is, i think i have it right finally
also please tell me how my indenting is, i think i have it right finally
local m = peripheral.wrap("top")
local solar = peripheral.wrap("right")
while true do
local energy = solar.getEnergyStored("1")
if energy == 500000 then
while energy > 0 do
m.write(solar.getEnergyStored("1"))
sleep(5)
redstone.setOutput("right", true)
end
else
m.write(solar.getEnergyStored("1"))
redstone.setOutput("right", false)
sleep(5)
end
end
edit: also sorry if my terminology is incorrect anywhere, im mostly self taught so i may have picked up the wrong terms here or there.Edited on 20 March 2014 - 12:36 AM