Posted 18 February 2013 - 03:24 AM
Title: End Fuction Error [lua]
Hello, I'm trying to get my Industrialcraft Reactor/Breeder to Work with Computercraft.
Errortype: every function returns an end-error. I suspect that I use the "function" incorrectly since I'm new to computercraft (could do this with redpower).
Thanks for your help.
My Code:
– Bundledcable (Back)
– White = Input Nuclear Control < 500 Reaktor One
– Orange = Input Nuclear Control < 500 Reaktor Two
– Magenta = Input Nuclear Control < 8000 Breeder One
– Green = Input MFSU = full
– Black = Input MFE = empty (no energy to power "Nuclear Control")
– Bundledcable (Bottom)
– White = Output Reactor One = On
– Orange = Output Reactor Two = On
– Magenta = Output Breeder One = On
– Black = Output Timer autoRefill = Off (unused atm)
– Top (single Redwire Signal)
– Mastercontrol = Input = Enable Control Program (Reactors run if conditons are met)
local Reactorcontrol
local ReactorOne
local ReactorTwo
local BreederOne
local ErrorCooling
local ErrorStorage
local ErrorRefillUraniumCell
local ErrorCoalDust
local ErrorIsotopCells
local Reactorcontrol
function Reactorcontrol()
while rs.testInput("top") == true
do
ReactorOne()
ReactorTwo()
BreederOne()
ErrorCooling()
ErrorStorage()
ErrorRefillUraniumCell()
ErrorCoalDust()
ErrorIsotopCells()
sleep(2)
end
else print("Control Disabled")
sleep(5)
end
function ReactorOne()
if rs.testBundledInput("back" , (colors.white)) == false
and rs.testBundledInput("back" , (colors.black)) == false
and rs.testBundledInput("back" , (colors.green)) == false
then print("Reactor One online") rs.setBundledOutput("bottom" , (colors.white))
end
else print("Reactor One offline")
end
function ReactorTwo()
if rs.testBundledInput("back" , (colors.orange)) == false
and rs.testBundledInput("back" , (colors.black)) == false
and rs.testBundledInput("back" , (colors.green)) == false
then print("Reactor Two online")
rs.setBundledOutput("bottom" , (colors.orange))
end
else print("Reactor Two offline")
end
function BreederOne()
if rs.testBundledInput("back" , colors.magenta) == false
and rs.testBundledInput("back" , colors.black) == false
then
rs.setBundledOutput("bottom" , (colors.magenta))
print("Breeder One online")
end
else print("Breeder One offline")
end
function ErrorCooling()
if rs.testBundledInput("back" , colors.white) == true
or rs.testBundledInput("back" , colors.orange) == true
or rs.testBundledInput("back" , colors.magenta) == true
then print("Cooling Error")
end
end
function ErrorStorage()
if rs.testBundledInput("bottom" , colors.green) == true
then print("Storage Overflow")
end
end
function ErrorRefillUraniumCell()
if rs.testBundledInput("bottom" , colors.yellow) == false
then print("Refill Uranium Cells")
end
end
function ErrorCoalDust()
if rs.testBundledInput("bottom" , colors.red) == false
then print("Refill Coal Dust")
end
end
function ErrorIsotopCells()
if rs.testBundledInput("bottom" , colors.blue) == false
then print("Refill Isotop Cells")
end
end
Hello, I'm trying to get my Industrialcraft Reactor/Breeder to Work with Computercraft.
Errortype: every function returns an end-error. I suspect that I use the "function" incorrectly since I'm new to computercraft (could do this with redpower).
Thanks for your help.
My Code:
Spoiler
– Automatic Nuclear-Reactor (100 EU/t per Reactor) with Breeder (5 EU/t) v 0.1– Bundledcable (Back)
– White = Input Nuclear Control < 500 Reaktor One
– Orange = Input Nuclear Control < 500 Reaktor Two
– Magenta = Input Nuclear Control < 8000 Breeder One
– Green = Input MFSU = full
– Black = Input MFE = empty (no energy to power "Nuclear Control")
– Bundledcable (Bottom)
– White = Output Reactor One = On
– Orange = Output Reactor Two = On
– Magenta = Output Breeder One = On
– Black = Output Timer autoRefill = Off (unused atm)
– Top (single Redwire Signal)
– Mastercontrol = Input = Enable Control Program (Reactors run if conditons are met)
local Reactorcontrol
local ReactorOne
local ReactorTwo
local BreederOne
local ErrorCooling
local ErrorStorage
local ErrorRefillUraniumCell
local ErrorCoalDust
local ErrorIsotopCells
local Reactorcontrol
function Reactorcontrol()
while rs.testInput("top") == true
do
ReactorOne()
ReactorTwo()
BreederOne()
ErrorCooling()
ErrorStorage()
ErrorRefillUraniumCell()
ErrorCoalDust()
ErrorIsotopCells()
sleep(2)
end
else print("Control Disabled")
sleep(5)
end
function ReactorOne()
if rs.testBundledInput("back" , (colors.white)) == false
and rs.testBundledInput("back" , (colors.black)) == false
and rs.testBundledInput("back" , (colors.green)) == false
then print("Reactor One online") rs.setBundledOutput("bottom" , (colors.white))
end
else print("Reactor One offline")
end
function ReactorTwo()
if rs.testBundledInput("back" , (colors.orange)) == false
and rs.testBundledInput("back" , (colors.black)) == false
and rs.testBundledInput("back" , (colors.green)) == false
then print("Reactor Two online")
rs.setBundledOutput("bottom" , (colors.orange))
end
else print("Reactor Two offline")
end
function BreederOne()
if rs.testBundledInput("back" , colors.magenta) == false
and rs.testBundledInput("back" , colors.black) == false
then
rs.setBundledOutput("bottom" , (colors.magenta))
print("Breeder One online")
end
else print("Breeder One offline")
end
function ErrorCooling()
if rs.testBundledInput("back" , colors.white) == true
or rs.testBundledInput("back" , colors.orange) == true
or rs.testBundledInput("back" , colors.magenta) == true
then print("Cooling Error")
end
end
function ErrorStorage()
if rs.testBundledInput("bottom" , colors.green) == true
then print("Storage Overflow")
end
end
function ErrorRefillUraniumCell()
if rs.testBundledInput("bottom" , colors.yellow) == false
then print("Refill Uranium Cells")
end
end
function ErrorCoalDust()
if rs.testBundledInput("bottom" , colors.red) == false
then print("Refill Coal Dust")
end
end
function ErrorIsotopCells()
if rs.testBundledInput("bottom" , colors.blue) == false
then print("Refill Isotop Cells")
end
end