Posted 07 January 2014 - 06:07 PM
I have a mining turtle program. It will dig a staircase and optionally place torches if you want it to. I made it in a FTB modpack. I use the Ender Storage mod to keep it's inventory empty and to refuel it. The way it refuels and empties its inventory is it goes backwards then up and places the 2 chests and does as it should. Quick note it places the chests up/down hence going backwards then up. Now here's the problem, sometimes it only goes back once or not at all and when it doesn't go back as it should it skips the going up part entirely. One cause of this is a player standing in the way blocking it. But other than that it's entirely random and when it starts doing it, it doesn't stop, I've labeled the turtle and been in creative so I may test this and it is 100% random with no cause at all. It just happens and doesn't stop once it does but some turtles don't have this problem and they're code is 100% the same letter for letter, number for number, here's my code.
(Note. This program means a lot to me. It's my first program with a big goal. First to go above 20 lines of code. First to go above 100 lines of code. I want to continue this program until it is perfect in every way shape and form so I will be grateful for any and all help I can get.)
(Note. This program means a lot to me. It's my first program with a big goal. First to go above 20 lines of code. First to go above 100 lines of code. I want to continue this program until it is perfect in every way shape and form so I will be grateful for any and all help I can get.)
term.clear()
print("Place torches?")
print("1 = Yes 2 = No")
local x = read()
local test = 0
term.setCursorPos(1,3)
if tonumber(x) == 1 then
test = test + 1
end
function placeTorches()
if test == 1 then
turtle.select(3)
turtle.placeDown()
turtle.select(1)
end
end
function emptyInventory()
for i = 4, 16 do
turtle.select(i)
turtle.dropDown(64)
end
end
function gravityCheck()
while turtle.dig do
if turtle.dig() == false then
break
end
end
end
function appleMine()
while true do
for i = 1,60 do
turtle.select(1)
placeTorches()
turtle.digDown()
turtle.down()
turtle.digDown()
turtle.down()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
gravityCheck()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.forward()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
gravityCheck()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.forward()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
gravityCheck()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.forward()
turtle.turnRight()
turtle.dig()
gravityCheck()
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.dig()
gravityCheck()
turtle.turnRight()
turtle.back()
turtle.back()
turtle.up()
turtle.placeDown()
emptyInventory()
appleFuel()
end
end
end
function appleFuel()
if turtle.getFuelLevel() <= 50 then
turtle.select(2)
turtle.placeUp()
turtle.suckUp()
turtle.refuel(64)
turtle.digUp()
end
end
turtle.select(1)
appleMine()