This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
bobbad's profile picture

Error at the end of a function

Started by bobbad, 14 April 2013 - 09:12 AM
bobbad #1
Posted 14 April 2013 - 11:12 AM
This is a simple farming program that i made today. The problem happens at row 18 when it crashes. Can anyone help?


turtle.turnLeft()
turtle.suck()
turtle.suck()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.dig()
turtle.forward()
turtle.turnLeft()

function farmLine()
  for i = 1,17 do
    turtle.dig()
    turtle.forward()
    turtle.digBack()
    turtle.placeBack()
  end
end

farmLine()
turtle.turnRight()
turtle.dig()
turtle.place()
turtle.forward()
turtle.turnRight()
farmLine()
turtle.turnLeft()
turtle.dig()
turtle.place()
turtle.forward()
turtle.turnLeft()
farmLine()
turtle.turnRight()
turtle.dig()
turtle.place()
turtle.forward()
turtle.turnRight()
farmLine()
turtle.turnRight()

for y = 1,9 do
  turtle.forward()
end
turtle.turnRight()
turtle.turnRight()
Engineer #2
Posted 14 April 2013 - 11:26 AM
turtle.digBack() is not a valid move. Use this for digging in the back:

turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnLeft()
turtle.turnLeft()
LBPHacker #3
Posted 14 April 2013 - 11:42 AM
And of course .placeBack is nil as well.