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

Called Functions Effect print() but Does not Effect turtle.forward()

Started by Xeonen, 15 September 2013 - 09:06 AM
Xeonen #1
Posted 15 September 2013 - 11:06 AM
Title: Called Functions Effect print() but Does not Effect turtle.forward()

Although not very new to coding, I am new to lua, I'm trying to write a function to carry out common tasks, the problem I've encountered is, I can not move turtles through the functions. Through the link you can see that turtle gets functions properly and even prints after turtle.forward() has been executed yet turtle does not move forward.

http://pastebin.com/c7UJbcaL
Bubba #2
Posted 15 September 2013 - 11:40 AM
Change it to something a bit more like this:

function tMove()
  if turtle.forward() then
    print("Forward")
  else
    print("Trouble moving forwards")
  end
end

Right now, your function does not indicate a successful move. It just attempts to move, and then prints forward regardless of what the turtle did. Have you checked the fuel in the turtle?