Posted 09 March 2015 - 11:56 PM
im working on a new reactor controller, just for the sake of having made like a few to many :P/> hehe
this time i want the reactor to turn on the reactor if the storage is below 200K RF
thats the code i use atm for controlling the power atm
the code i want to change is this
to somethin like a until statement..
and thats where i get lost :D/> hehe, its pretty late, so im sorry if i didnt notice something obvious :)/>
i looked up the repeat loop, but wouldnt it just lock the entire program to that loop, until the power got above a certain point??
if that is true, then i will just put it in a function on its own, and use the parallel.waitForAny
so what i am asking for i the end, is the means to make a "until loop" withing the current code i have :)/>
this time i want the reactor to turn on the reactor if the storage is below 200K RF
local mon = peripheral.wrap("monitor_1")
local bank = peripheral.wrap("tile_blockcapacitorbank_name_0")
local rea = peripheral.wrap("bottom")
local function pos(x,y)
mon.setCursorPos(x,y)
end
pos(1,1)
mon.write("Vibrant Capacitor bank")
while true do
local banken = bank.getEnergyStored()
pos(1,2)
mon.clearLine()
if banken >= 1000000 then
local enermill = math.floor((banken*16)/1000000)
mon.write("Energy Stored:"..enermill.." Million RF")
elseif banken <= 1000000 then
local enerthou = math.floor((banken*16)/1000)
mon.write("Energy Stored:"..enerthou.." Thousand RF")
if enerthou <= 200 then
rea.setActive(true)
else
rea.setActive(false)
end
end
sleep(2)
thats the code i use atm for controlling the power atm
the code i want to change is this
if enerthou <= 200 then
rea.setActive(true)
else
rea.setActive(false)
end
to somethin like a until statement..
and thats where i get lost :D/> hehe, its pretty late, so im sorry if i didnt notice something obvious :)/>
i looked up the repeat loop, but wouldnt it just lock the entire program to that loop, until the power got above a certain point??
if that is true, then i will just put it in a function on its own, and use the parallel.waitForAny
so what i am asking for i the end, is the means to make a "until loop" withing the current code i have :)/>