Jump to content




turtle that handels bedrock?


  • You cannot reply to this topic
2 replies to this topic

#1 jakemg

  • Members
  • 88 posts

Posted 13 June 2013 - 10:53 PM

Hi Im trying to make turtle program where i have a long line of turtles and they all dig down to bed rock then then go forward and dig all the way down again. But I cant quite cant my turtle to recognize when they hit bedrock
what im using now
function down()
  while true do
  turtle.digDown()
  turtle.down()
   if turtle.down == false then
   print("bedrock")
   end
  end
end

but this isnt working at all because he wont stop his while true loop so he never prints bedrock

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 13 June 2013 - 10:57 PM

And it will never print that it is at bedrock because the function turtle.down always exists, and that is all you're checking.

This is how you would need to do it
local function down()
  while not turtle.down() do
    if turtle.detectDown() then --# it couldn't move because of a block
      if not turtle.digDown() then --# it couldn't dig a block, assume it is a diamond axe, and a the only thing that cannot be dug is bedrock.
        print("bedrock")
      end
    elseif turtle.attack() then --# it couldn't move because of a mob
      while turtle.attack() do end
    elseif turtle.getFuelLevel() == 0 then --# it couldn't move because of no fuel
      --# refuel it
    end
  end
end


#3 jakemg

  • Members
  • 88 posts

Posted 14 June 2013 - 01:14 PM

thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users