Posted 12 October 2012 - 03:21 PM
Re: Very simple program will go down but will not return to me properly
I have a large mined pit in front of me (from an old quarry) and it is covered with a layer of glass on top.
I want a turtle to move onto the glass, dig one out, then just move to the bottom and come back up. (I will add the "fill hole with dirt as it comes up" part later).
So I run it, and it goes to the bottom (I think) but it only comes halfway back up.
Help ?
I have a large mined pit in front of me (from an old quarry) and it is covered with a layer of glass on top.
I want a turtle to move onto the glass, dig one out, then just move to the bottom and come back up. (I will add the "fill hole with dirt as it comes up" part later).
So I run it, and it goes to the bottom (I think) but it only comes halfway back up.
Help ?
--[[ Program name : testmovedown
this program moves forward 1 then
digs below if necessary once then
moves down as far as it can then
moved back up to starting position
--]]
--[[ Be sure the turtle has...
slot 13 has 64 coal/charcoal
--]]
function refuel()
fuellvl = turtle.getFuelLevel()
if fuellvl<100 then
amtchar = turtle.getItemCount(13)
if amtchar > 1 then
turtle.select(13)
turtle.refuel(2)
turtle.select(1)
else
if amtchar > 0 then
turtle.select(13)
turtle.refuel(1)
turtle.select(1)
end
end
end
end
--[[ set numeric var's --]]
fuellvl = 0
amtchar = 0
downMoves = 0
X = 0
fillSlot = 0
--[[ move forward one --]]
refuel()
turtle.forward()
--[[ for first move, it might have to dig through something
as I may have sealed a deep hole --]]
if turtle.down() == false then
turtle.digDown()
end
--[[ move down as far as it can --]]
while turtle.down() do
refuel()
turtle.down()
downMoves = downMoves + 1
end
--[[ move back up --]]
while downMoves > 0 do
refuel()
turtle.up()
downMoves = downMoves - 1
end