Jump to content




Turtle Program Not Working in 1.4 Update


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

#1 doodlebug95

  • New Members
  • 2 posts

Posted 08 January 2013 - 05:22 PM

I created my first real program for a mining turtle (back when they had 9 slots)

Now when I run it in the 1.4 update (turtles have 16 slots) it just spins in a circle

Whats wrong?

function dig()
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.digUp()
  turtle.up()
  turtle.digUp()
  turtle.up()
  turtle.turnRight()
  turtle.turnRight()
  turtle.dig()
  turtle.forward()
  turtle.digDown()
  turtle.dig()
  turtle.forward()
  turtle.digDown()
  turtle.down()
  turtle.digDown()
  turtle.down()
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.forward()
  turtle.turnRight()
end
function moveForward()
  turtle.select(2)
  turtle.dig()
  turtle.forward()
  if turtle.detectDown() == false then
  turtle.placeDown()
  end
end
function placeTorch()
  turtle.select(1)
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.place()
  turtle.turnRight()
  turtle.turnRight()
end
term.clear()
term.setCursorPos(1, 1)
print("How Far Should I Dig?")
numberToMine = tonumber(read())
counter = 0
torchCounter = 0
textutils.slowPrint("Please Put 20 Torches in My Top Left Slot")
while turtle.getItemCount(1) < 20 do
	sleep(5)
print("Please Insert " .. 20 - turtle.getItemCount(1) .. " more torches")
end
term.clear()
term.setCursorPos(1, 1)
textutils.slowPrint("Now Tunneling")

while counter < numberToMine do
  if torchCounter == 10 then
	placeTorch()
torchCounter = 0
  end
  moveForward()
  dig()
  counter = counter + 1
  torchCounter = torchCounter + 1
end
print("Mined Tunnel " .. numberToMine .. " Block(s) Long")


#2 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 08 January 2013 - 05:23 PM

Turtles need fuel to move. Put coal in the current slot and type 'refuel', or call turtle.refuel()

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 08 January 2013 - 05:38 PM

and if you opt for the code way add a function into the code that uses
turtle.getFuelLevel()
which returns the number of blocks the turtle can move. also notable is if the turtle cannot move, it can be; 1. Block in its way ( use turtle.dig() ), 2. Mob in its way ( use turtle.attack() ) or 3. out of fuel ( write a fuel checking function )

#4 doodlebug95

  • New Members
  • 2 posts

Posted 09 January 2013 - 03:21 PM

Thanks guys I can't believe I missed that





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users