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

Mining Turtle that quarries only dirt, gravel, and stone

Started by fspike, 04 December 2015 - 04:31 PM
fspike #1
Posted 04 December 2015 - 05:31 PM
Im looking for a program that mines only stone dirt and gravel within a rectangular area which you give length width and height for, while leaving all ores where they are. If you know a program like this already I could use that would be great, otherwise Id appreciate some tips for making the program.
Hydrotronics #2
Posted 20 December 2015 - 05:27 PM
tips, use an api that shortens and compacts turtle code (mine is in these brackets) and also use turtle.inspect for detecting the type of block. Other than that, i'd think it's pretty simple, just time consuming
Lupus590 #3
Posted 20 December 2015 - 06:31 PM
tips, use an api that shortens and compacts turtle code (mine is in these brackets) and also use turtle.inspect for detecting the type of block. Other than that, i'd think it's pretty simple, just time consuming

You could make that script smaller if you use string.lower(str)
KingofGamesYami #4
Posted 20 December 2015 - 06:48 PM
Place stone, dirt, and gravel in the first three slots of the turtle, then use turtle.compare to determine whether or not to mine something.


local function isGarbage()
  for i = 1, 3 do --#do this for slots 1, 2, and 3
    turtle.select( i ) --#select the slot
    if turtle.compare() then --#if the stuff in the slot is what's in front of the turtle
      return true --#return true
    end
  end
  return false --#none of the three slots matched what's in front
end


--#usage

if isGarbage() then
  turtle.dig()
else
  --#we need to go somewhere else
end