1 posts
Posted 03 May 2013 - 11:58 PM
I was curious if there is a way (or simple program) that makes a Mining Turtle dig specific blocks? For example, if the excavate command was used but the turtle only mined the smooth stone and left everything else. I've seen programs (like Ore Quarry) that mine everything EXCEPT certain blocks but that's not what I want. I'm new to ComputerCraft and have never used the Lua programming language. If there is already a program for this I apologize as I was unable to find it. Google can only do so much with "mining turtle". LOL! Thank you for the help!
8543 posts
Posted 05 May 2013 - 02:17 AM
Split into new topic.
41 posts
Posted 05 May 2013 - 09:41 AM
The only way to do anything like this is to use turtle.compare(), turtle.compareUp(), and turtle.compareDown(). The compare functions uses the block the turtle currently has selected and compares it to the block in front/above/below it. If they are they same, it returns true. So you could do something like this:
local slotsNum = 3 -- number of slots to check
local slotsToCheck = { 14, 15, 16 } -- slots with blocks to check
function shouldMine()
for x = 1, slotsNum do
turtle.select(slotsToCheck[x])
if (turtle.compare) then
--mining code
end
end
end