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

How can I make a turtle /select/break specific blocks?

Started by Arcane_Asylum, 30 July 2013 - 12:53 AM
Arcane_Asylum #1
Posted 30 July 2013 - 02:53 AM
Title: How can I make a turtle /select/break specific blocks?

I was wondering if I can make a turtle better at mining by getting it to drop specific items like cobblestone and dirt, and if it is, for example, just doing a basic tunnel, and it detects a diamond on the side, it will mine that diamond then continue with the tunneling. This is no request for a big code or something, I am just wondering if there is a way to make a code kind of like this one (not one I am trying to use, just making something up to make it more understandable)

a = 1
while a ~=50 do
turtle.digForward()
turtle.forward()
a = a + 1
if turtle.detectRight() = DiamondOre, GoldOre, IronOre then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
while a ~=50 do
turtle.digForward()
turtle.forward()
a = a + 1
end

Something like that so when it is digging if there is Diamond/gold/iron ore the to right it will mine it. If this is possible please help and if it is not, it's alright I can manage without it! Thank!
jesusthekiller #2
Posted 30 July 2013 - 10:44 AM
Impossible (unless moded). Turtles are blind.
Bubba #3
Posted 30 July 2013 - 12:19 PM
Well possible, but highly inefficient.

You could have the turtle turn right, compare a block in its inventory to the wall, and then decide whether or not to dig it. However that would be super slow and pointless.
TyDoesMC #4
Posted 30 July 2013 - 11:32 PM
It Is Possible Use This Before The Line Of Code Where He Break's The Block


	
	turtle.select(Slot) --Put In The Slot He Is Comparing To, 1-16
	turtle.compare() --Or turtle.compareDown ect.
	

turtle.compare() Is a Boolean Success Automaticly (If Block He Is Comparing To Is Correct)
Check Out: http://computercraft...ki/Turtle_(API)
For More Help :D/>
Happy To Help
jesusthekiller #5
Posted 31 July 2013 - 04:14 AM
Bubba already said that… It will be slower than just breaking that block.