Every time I try to run this program for chopping down redwoods I get this message, "Fell :53: attempt to index ? (a nil value)" If anyone could help me out with this problem that would be great. Here is the program link: http://pastebin.com/A89YVycp
And the program:
local function checkFuel()
if turtle.getFuelLevel() < 1 then
turtle.select(1)
turtle.refuel(1)
end
end
local function column()
while turtle.digUp() do
turtle.dig()
checkFuel()
turtle.up()
end
turtle.dig()
checkFuel()
while turtle.down() do
checkFuel()
end
end
local function digmove()
checkFuel()
turtle.dig()
turtle.forward()
end
local function plant()
turtle.select(2)
turtle.forward(1)
turtle.place()
turtle.turnRight()
turtle.forward(1)
turtle.turnLeft()
turtle.place()
turtle.turnRight()
turtle.turnRight()
turtle.forward(1)
turtle.turnRight()
turtle.turnRight()
turtle.place()
turtle.turnLeft()
turtle.forward(1)
turtle.turnRight()
turtle.place()
end
local function dropwood()
for i=3, 16 do
turtle.select( i)
turtle.dropDown()
end
turtle.select(3)
end
while true do --Always loop
dropwood()
plant()
turtle.up()
local Wait, Correct = "0", "1"
while Wait~=Correct do
if turtle.detect()==true then
Wait = "1"
print("success")
end
sleep(5)
end
turtle.down()
digmove()
column()
turtle.turnRight()
digmove()
turtle.turnLeft()
column()
turtle.turnLeft()
digmove()
digmove()
turtle.turnRight()
column()
turtle.turnRight()
turtle.forward(1)
turtle.turnRight()
turtle.forward(1)
turtle.turnRight()
turtle.turnRight()
end
And the program:
local function checkFuel()
if turtle.getFuelLevel() < 1 then
turtle.select(1)
turtle.refuel(1)
end
end
local function column()
while turtle.digUp() do
turtle.dig()
checkFuel()
turtle.up()
end
turtle.dig()
checkFuel()
while turtle.down() do
checkFuel()
end
end
local function digmove()
checkFuel()
turtle.dig()
turtle.forward()
end
local function plant()
turtle.select(2)
turtle.forward(1)
turtle.place()
turtle.turnRight()
turtle.forward(1)
turtle.turnLeft()
turtle.place()
turtle.turnRight()
turtle.turnRight()
turtle.forward(1)
turtle.turnRight()
turtle.turnRight()
turtle.place()
turtle.turnLeft()
turtle.forward(1)
turtle.turnRight()
turtle.place()
end
local function dropwood()
for i=3, 16 do
turtle.select( i)
turtle.dropDown()
end
turtle.select(3)
end
while true do --Always loop
dropwood()
plant()
turtle.up()
local Wait, Correct = "0", "1"
while Wait~=Correct do
if turtle.detect()==true then
Wait = "1"
print("success")
end
sleep(5)
end
turtle.down()
digmove()
column()
turtle.turnRight()
digmove()
turtle.turnLeft()
column()
turtle.turnLeft()
digmove()
digmove()
turtle.turnRight()
column()
turtle.turnRight()
turtle.forward(1)
turtle.turnRight()
turtle.forward(1)
turtle.turnRight()
turtle.turnRight()
end