Posted 07 April 2012 - 11:27 AM
This is just a little program I coded to help with my search for ores in my mine. It's pretty simple, just digging a 1x2 tunnel of the entered length (will get to that in a bit) and then returning to the entrance of the branch, placing torches as it goes (if that is turned on).
Usage
First dig out the main tunnel for the branches to branch off and then put the turtle down in front of the wall you want to put a branch in and start the program. There are two arguments that can be entered after the program name: the branches length and whether to place torches. So for example 'branch 64 nt' would make a tunnel 64 blocks long with no torches placed, whilst 'branch 64' or branch 64 t' would dig the same length tunnel but place torches. Simples!
Code
–Starting the dig
for x = 1, steps
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
end
–Getting into position for the return
turtle.digUp()
turtle.up()
turtle.turnRight()
turtle.turnRight()
–Changing the variable to allow for torches to be placed every 8
steps = steps / 8
–Starting the return
for x = 1, steps do
if torch == "t" then
turtle.turnLeft()
turtle.dig()
turtle.place()
turtle.turnRight()
end
for x = 1, 8 do
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
end
end
Todo:
Add pics and possibly a video.
Usage
First dig out the main tunnel for the branches to branch off and then put the turtle down in front of the wall you want to put a branch in and start the program. There are two arguments that can be entered after the program name: the branches length and whether to place torches. So for example 'branch 64 nt' would make a tunnel 64 blocks long with no torches placed, whilst 'branch 64' or branch 64 t' would dig the same length tunnel but place torches. Simples!
Code
--Getting the variables
local tArgs = { ... }
steps = tonumber(tArgs[1])
torch = tArgs[2]
--Assigning defaults
steps = steps or 1
torch = torch or "t"
–Starting the dig
for x = 1, steps
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
end
–Getting into position for the return
turtle.digUp()
turtle.up()
turtle.turnRight()
turtle.turnRight()
–Changing the variable to allow for torches to be placed every 8
steps = steps / 8
–Starting the return
for x = 1, steps do
if torch == "t" then
turtle.turnLeft()
turtle.dig()
turtle.place()
turtle.turnRight()
end
for x = 1, 8 do
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
end
end
Todo:
Add pics and possibly a video.