This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tigerlife's profile picture

CaveFinder

Started by Tigerlife, 17 March 2012 - 03:40 PM
Tigerlife #1
Posted 17 March 2012 - 04:40 PM
hey guys i created a program for the turtle heres what i put in disk/startup

while turtle.detectDown() do
turtle.digDown()
turtle.down()
end
while not turtle.detectDown() do
turtle.up()
end




there is a known glitch, if it dosent hit a cave or liquid, it will go to bedrock and get glitched trying to go down and remove bedrock, but i dont know how to fix that…
petrus4 #2
Posted 18 March 2012 - 02:21 PM


#  The digUp() call in bedrockcheck is simply to make sure that the turtle definitely gets to the surface; in case sand has fallen down or something.
#   In bedrockcheck, comeup() is called in response to turtle.digDown() responding false, which it will do in the case of bedrock.
#  This ended up fairly complicated, so I've split it into multiple functions so that it is readable.

function comeup()
	for i=1,59
	do
	turtle.digUp()
	turtle.up()
	end
end

function bedrockcheck()
	if not turtle.digDown() then
	comeup()
	break
	end
end

function godown()
	while turtle.detectDown() do
	turtle.digDown()
	turtle.down()
	end
end

function cavefind()
    while not turtle.detectDown() do
    comeup()
    end
end

godown()
cavefind()
bedrockcheck()
comeup()
Tigerlife #3
Posted 08 April 2012 - 09:47 PM
nonono :P/>/> what i mean is you start on surface, and mine down. all i need is that if my turtle dosent hit a cave and hits bedrock to not get stuck down there but strait back up…
Tankman101 #4
Posted 14 April 2012 - 10:42 PM
I think he just did that…i'm not sure though.