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

Basic Y Level Tunnel Mining

Started by iTzXWhite, 07 September 2012 - 12:34 AM
iTzXWhite #1
Posted 07 September 2012 - 02:34 AM
I have been trying to get this bug-proof for almost a week. No luck, but here's everything working except the Y level for the return on the way up. Assistance welcome and enjoy!



function Mine(x)
for i = 1, x do
turtle.dig()
turtle.forward()
turtle.turnLeft()
turtle.dig()
turtle.digUp()
turtle.up()
turtle.dig()
turtle.digUp()
turtle.up()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.down()
turtle.dig()
turtle.down()
turtle.dig()
turtle.down()
turtle.turnLeft()
end
end


function Down(x)
for i = 1, x do
turtle.digDown()
turtle.down()
end
end


function Up(x)
for i = 1, x do
turtle.up()
end
end


function Return(x)
for i = 1, x do
turtle.forward()
end
end


term.clear()
term.setCursorPos(1,1)
print("How far should I mine?")
local a = read()
term.clear()
term.setCursorPos(1,1)
print("How far down should I go?")
local b = read()
term.clear()
term.setCursorPos(1,1)
print("Mining...")
Down(b)
Mine(a)
turtle.turnLeft()
turtle.turnLeft()
Return(a)
Up(b)
turtle.turnLeft()
turtle.turnLeft()
Noodle #2
Posted 07 September 2012 - 02:46 AM
Whats up with your mine function?
Its mining all over 0.0
iTzXWhite #3
Posted 07 September 2012 - 05:04 PM
The Mine() function digs out a 3x3 hole in the wall in front of the turtle and then sets it back in the same position, but 1 block forward. Unfortunately, I had to write out all of those commands at least once. Makes the code look sloppy .