TheKojent icon

Try API

TheKojent | PRO | 03/29/13 03:44:51 AM UTC | 0 ⭐ | 215 👁️ | Never ⏰ | []
Lua |

770 B

|

None

|

0 👍

/

0 👎

--API for movement attempts in the directions a turtle can move.
 
function forward()
  while not turtle.forward() do
    if turtle.detect() then
      if not turtle.dig() then
        return false
      end
    elseif not turtle.attack() then
      sleep(0.5)
    end
  end
  return true
end
 
function down()
  while not turtle.down() do
    if turtle.detectDown() then
      if not turtle.digDown() then
        return false
      end
    elseif not turtle.attackDown() then
      sleep(0.5)
    end
  end
  return true
end
 
function up()
  while not turtle.up() do
    if turtle.detectUp() then
      if not turtle.digUp() then
        return false
      end
    elseif not turtle.attackUp() then
      sleep(0.5)
    end
  end
  return true
end

Comments