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

How do turtles interact with players?

Started by Imprivate, 07 April 2017 - 03:45 PM
Imprivate #1
Posted 07 April 2017 - 05:45 PM
I've been playing around with turtles trying to get them to physically move a player by surrounding the player in turtles and using turtle.forward(). I initially thought it would work since turtles push the player forwards when they move forwards. This does indeed work…just not all the time. Sometimes the turtle just won't move forward (the move forward fails).

It can usually push me in a straight line, but when I experiment with turning things start to go wrong.

For example:



if turtle.forward() then
  print("1st forward complete")
end
if turtle.forward() then
  print("2nd forward complete")
end
if turtle.forward() then
  print("3rd forward complete")
end

I use this as validation to check which command failed, and a random one sometimes fails.

Does anyone know how turtles are supposed to interact with players, or what could make them sometimes fail? Thanks

Using ComputerCraft 1.79, Minecraft 1.8.9
Edited on 07 April 2017 - 06:29 PM
Bomb Bloke #2
Posted 08 April 2017 - 01:58 AM
If it's entirely random, then you should just be able to repeat until it works.

local function forward(amount)
  for i = 1, amount do
    while not turtle.forward() do
      print("Move failed, might be obstructed?")
    end
  end
end
Imprivate #3
Posted 08 April 2017 - 09:26 PM
If it's entirely random, then you should just be able to repeat until it works.

local function forward(amount)
  for i = 1, amount do
	while not turtle.forward() do
	  print("Move failed, might be obstructed?")
	end
  end
end

Thanks, I suppose I could do this, but was just wondering if there was meant to be some sort of documentation of how turtles are meant to deal with players when they meet, because it seemed random/odd.