I've been attempting a code to chop a 4x4 extrabiomes fir tree in order to get saplings for biofuel. I threw this little routine together to test before writing more code:
I get "Biogen:86: attempt to call number" line 86 is under --MAIN PROGRAM! on the bonemeal() function. It places the saplings and prints that it's done so, then returns the error. However, if I run the bonemeal() function on its own, I get no error. Same goes for refuel() and saplings(). I can't figure out what's wrong... I imagine it's something incredibly simple I've overlooked, if anyone could point it out, I'd appreciate it.
Code:
-- VARIABLES!
local sapling
local bonemeal
local wood
local fuel
-- FUNCTIONS!
function refresh()
sapling = turtle.getItemCount(1)
bonemeal = turtle.getItemCount(2)
wood = turtle.getItemCount(3)
fuel = turtle.getItemCount(16)
if (sapling < 5) or (bonemeal < 2) or (wood < 2) or (fuel < 21) then
print("Refresh placeholder")
end
end
function sapling()
print("Placing Saplings...") print("")
refresh()
turtle.select(1)
turtle.place()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
turtle.place()
turtle.turnRight()
turtle.place()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.turnLeft()
turtle.place()
print("Saplings are placed!")
end
function bonemeal()
print("Growing the tree")
refresh()
turtle.select(2)
turtle.place()
end
function cutUp()
print("Going up!")
refresh()
turtle.select(3)
while turtle.compare() do
turtle.dig()
turtle.digUp()
turtle.up()
end
print("Finished!")
end
function cutDown()
print("Going down!")
refresh()
turtle.select(3)
while turtle.compare() do
turtle.dig()
turtle.digDown()
turtle.down()
end
print("Finished!")
end
function refuel()
print("Refueling!")
if turtle.getFuelLevel() < 300 then
turtle.select(16)
for i = 1 , 64 do
turtle.refuel()
end
end
print("Finished!")
end
-- MAIN PROGRAM!
refuel()
sapling()
bonemeal()
cutUp()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
cutDown()
I get "Biogen:86: attempt to call number" line 86 is under --MAIN PROGRAM! on the bonemeal() function. It places the saplings and prints that it's done so, then returns the error. However, if I run the bonemeal() function on its own, I get no error. Same goes for refuel() and saplings(). I can't figure out what's wrong... I imagine it's something incredibly simple I've overlooked, if anyone could point it out, I'd appreciate it.