Posted 20 January 2016 - 07:30 AM
Hey guys the code is this:
It was working properly whitout any problem, until by mistake I did destroy the Capacitor modem that is attached to the openperipheral, so the name did go from "tile_blockcapacitorbank_name_0" to "tile_blockcapacitorbank_name_1" now I get an error every time on the line 7 ?!
Rly don't understand the problem here :/
capa = peripheral.find("tile_blockcapacitorbank_name")
reactor = peripheral.find("BigReactors-Reactor")
-- Num of capacitors
local maxCapacitor = 15
-- Max energy stored by Capacitors
local maxEnergy = capa.getMaxEnergyStored() * maxCapacitor
-- Turn on at
local turnOnAt = 50
-- Turn off at (Not use 100)
local turnOffAt = 90
local manual = false
while true do
energyStored = capa.getEnergyStored() * maxCapacitor
energyPerc = math.floor((energyStored / maxEnergy) * 100)
print(energyPerc)
if energyPerc <= turnOnAt then
reactor.setActive(true)
print("Activating the reactor")
elseif energyPerc >= turnOffAt then
if reactor.getActive() then
print("Deactivating the reactor")
reactor.setActive(false)
end
end
sleep(10)
end
It was working properly whitout any problem, until by mistake I did destroy the Capacitor modem that is attached to the openperipheral, so the name did go from "tile_blockcapacitorbank_name_0" to "tile_blockcapacitorbank_name_1" now I get an error every time on the line 7 ?!
Rly don't understand the problem here :/