Posted 22 March 2012 - 05:31 PM
This program has 2 main Features
The first Feature is to do a tunnel of 3x2
-You can choose how deep it will go
-You can enable the "dropOff" option (what it does? :
( you can use redpower buildcraft , with the "dropOff" function and store it automaticly )
The second Feature is mining branches of 2x2
-You choose how many branches the turtle will mine
-You choose how deep the branches will be
- You can enable the "dropOff" option (what it does? :
You can use the "dropOff" option with RedpowerBuildcraftPowercraft to automate all of the mining the turtle does
The code:
j=true
while j do
if turtle.detect() then
turtle.dig()
sleep(1)
else
j=false
end
end
end
function checkUp()
j=true
while j do
if turtle.detectUp() then
turtle.digUp()
sleep(1)
else
j=false
end
end
end
function ko1()
check()
turtle.forward()
checkUp()
turtle.turnLeft()
check()
turtle.forward()
checkUp()
turtle.turnRight()
end
function ko2()
check()
turtle.forward()
checkUp()
turtle.turnRight()
check()
turtle.forward()
checkUp()
turtle.turnLeft()
end
function branch(m,lengthM)
while (m<lengthM) do
ko1()
ko2()
m=m+2
end
turtle.turnLeft()
sleep(0.5)
turtle.forward()
sleep(0.5)
ko1()
ko2()
ko1()
ko2()
turtle.turnLeft()
sleep(0.5)
turtle.forward()
m=0
while m<(lengthM-2) do
ko1()
ko2()
m=m+2
end
check()
turtle.forward()
check()
turtle.forward()
end
br=1
dist=0
write(" tunnel or branches (1- Tunnel ,2- Branches )")
print(newline)
choice=read()
print(newline)
if (choice=='2') then
write("Enter how mant Branches you want ")
print(newline)
length=read()
length=tonumber(length)
print(newline)
write("Enter the length of the Branches (Even Number)")
print(newline)
lengthM=read()
lengthM=tonumber(lengthM)
if lengthM<2 then lengthM=2 end
write("Do you want dropOff? ( yes or no)")
print(newline)
dropOff=read()
m=0
n=0
loko=true
turtle.turnRight()
while n<length do
turtle.forward()
branch(m,lengthM)
br=1
n=n+1
dist=dist+5
if dropOff=='yes' then
turtle.turnLeft()
for i=1, dist do
turtle.forward()
end
for i=1 , 9 do
turtle.select(i)
turtle.drop()
end
if n<length then
turtle.turnLeft()
turtle.turnLeft()
for i=1, dist do
turtle.forward()
end
turtle.turnLeft()
end
end
if n<length then
turtle.forward()
branch(m,lengthM)
br=2
n=n+1
dist=dist-5
if dropOff=='yes' then
turtle.turnRight()
for i=1, dist do
turtle.forward()
end
for i=1 , 9 do
turtle.select(i)
turtle.drop()
end
if n<length then
turtle.turnLeft()
turtle.turnLeft()
for i=1, dist do
turtle.forward()
end
turtle.turnRight()
end
end
end
if br==2 then
if n<length then
turtle.turnLeft()
for i=1, 8 do
turtle.forward()
end
dist=dist+8
turtle.turnRight()
else if (not dropOff=='yes') then turtle.turnRight()
for i=1 , dist do
turtle.forward()
end
end
end
end
end
end
if choice=='1' then
write("Enter the length of the tunnel ")
print(newline)
oreh=read()
oreh=tonumber(oreh)
write("Do you want dropOff? ( yes or no)")
print(newline)
dropOff=read()
h=0
while h<oreh do
h=h+1
check()
turtle.forward()
checkUp()
turtle.turnLeft()
check()
turtle.up()
check()
turtle.turnRight()
turtle.turnRight()
check()
turtle.down()
check()
turtle.turnLeft()
end
h=0
turtle.turnLeft()
turtle.turnLeft()
while h<oreh do
turtle.forward()
h=h+1
end
if dropOff=='yes' then
for i=1 , 9 do
turtle.select(i)
turtle.drop()
end
end
end
Enjoy :]
Post bugs here and new ideas to add
edit1: fixed a small bug that didnt let the turtle continue more then 2 branches
edit2: minor bug fixed - when the turtle finished the branches and dropOff was on , the turtle went a few blocks away from the place he droped hes loot
The first Feature is to do a tunnel of 3x2
-You can choose how deep it will go
-You can enable the "dropOff" option (what it does? :
Spoiler
When the turtle finishes the tunnel , he will come back to the block he was standing at the begining and he will drop all of hes items( you can use redpower buildcraft , with the "dropOff" function and store it automaticly )
The second Feature is mining branches of 2x2
-You choose how many branches the turtle will mine
-You choose how deep the branches will be
- You can enable the "dropOff" option (what it does? :
Spoiler
When the turtle finishes a branch , he will come back to the block he was standing at the begining and he will drop all of hes items and then if he has more branches to mine he will resume hes miningYou can use the "dropOff" option with RedpowerBuildcraftPowercraft to automate all of the mining the turtle does
The code:
Spoiler
function check()j=true
while j do
if turtle.detect() then
turtle.dig()
sleep(1)
else
j=false
end
end
end
function checkUp()
j=true
while j do
if turtle.detectUp() then
turtle.digUp()
sleep(1)
else
j=false
end
end
end
function ko1()
check()
turtle.forward()
checkUp()
turtle.turnLeft()
check()
turtle.forward()
checkUp()
turtle.turnRight()
end
function ko2()
check()
turtle.forward()
checkUp()
turtle.turnRight()
check()
turtle.forward()
checkUp()
turtle.turnLeft()
end
function branch(m,lengthM)
while (m<lengthM) do
ko1()
ko2()
m=m+2
end
turtle.turnLeft()
sleep(0.5)
turtle.forward()
sleep(0.5)
ko1()
ko2()
ko1()
ko2()
turtle.turnLeft()
sleep(0.5)
turtle.forward()
m=0
while m<(lengthM-2) do
ko1()
ko2()
m=m+2
end
check()
turtle.forward()
check()
turtle.forward()
end
br=1
dist=0
write(" tunnel or branches (1- Tunnel ,2- Branches )")
print(newline)
choice=read()
print(newline)
if (choice=='2') then
write("Enter how mant Branches you want ")
print(newline)
length=read()
length=tonumber(length)
print(newline)
write("Enter the length of the Branches (Even Number)")
print(newline)
lengthM=read()
lengthM=tonumber(lengthM)
if lengthM<2 then lengthM=2 end
write("Do you want dropOff? ( yes or no)")
print(newline)
dropOff=read()
m=0
n=0
loko=true
turtle.turnRight()
while n<length do
turtle.forward()
branch(m,lengthM)
br=1
n=n+1
dist=dist+5
if dropOff=='yes' then
turtle.turnLeft()
for i=1, dist do
turtle.forward()
end
for i=1 , 9 do
turtle.select(i)
turtle.drop()
end
if n<length then
turtle.turnLeft()
turtle.turnLeft()
for i=1, dist do
turtle.forward()
end
turtle.turnLeft()
end
end
if n<length then
turtle.forward()
branch(m,lengthM)
br=2
n=n+1
dist=dist-5
if dropOff=='yes' then
turtle.turnRight()
for i=1, dist do
turtle.forward()
end
for i=1 , 9 do
turtle.select(i)
turtle.drop()
end
if n<length then
turtle.turnLeft()
turtle.turnLeft()
for i=1, dist do
turtle.forward()
end
turtle.turnRight()
end
end
end
if br==2 then
if n<length then
turtle.turnLeft()
for i=1, 8 do
turtle.forward()
end
dist=dist+8
turtle.turnRight()
else if (not dropOff=='yes') then turtle.turnRight()
for i=1 , dist do
turtle.forward()
end
end
end
end
end
end
if choice=='1' then
write("Enter the length of the tunnel ")
print(newline)
oreh=read()
oreh=tonumber(oreh)
write("Do you want dropOff? ( yes or no)")
print(newline)
dropOff=read()
h=0
while h<oreh do
h=h+1
check()
turtle.forward()
checkUp()
turtle.turnLeft()
check()
turtle.up()
check()
turtle.turnRight()
turtle.turnRight()
check()
turtle.down()
check()
turtle.turnLeft()
end
h=0
turtle.turnLeft()
turtle.turnLeft()
while h<oreh do
turtle.forward()
h=h+1
end
if dropOff=='yes' then
for i=1 , 9 do
turtle.select(i)
turtle.drop()
end
end
end
Enjoy :]
Post bugs here and new ideas to add
edit1: fixed a small bug that didnt let the turtle continue more then 2 branches
edit2: minor bug fixed - when the turtle finished the branches and dropOff was on , the turtle went a few blocks away from the place he droped hes loot