Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drop() -- drops all stuff into inventory
- turtle.select(1)
- turtle.drop()
- turtle.select(2)
- turtle.drop()
- turtle.select(3)
- turtle.drop()
- turtle.select(4)
- turtle.drop()
- turtle.select(5)
- turtle.drop()
- turtle.select(6)
- turtle.drop()
- turtle.select(7)
- turtle.drop()
- turtle.select(8)
- turtle.drop()
- turtle.select(9)
- turtle.drop()
- turtle.select(10)
- turtle.drop()
- turtle.select(11)
- turtle.drop()
- turtle.select(12)
- turtle.drop()
- turtle.select(13)
- turtle.drop()
- turtle.select(14)
- turtle.drop()
- turtle.select(15)
- turtle.drop()
- turtle.select(16)
- turtle.drop()
- end
- function backL() --goes back when turtle is facing left and empties inventory
- turtle.turnLeft()
- turtle.forward()
- if z ~= 1
- then
- for g=1, z-1
- do turtle.down()
- end
- end
- for i=1 , y-1
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- drop()
- sleep(.1)
- if z~=1
- then
- for g=1, z-1
- do turtle.up()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=1 , y
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- turtle.turnLeft()
- end
- function backR() --goes back when turtle is facing right and empties inventory
- turtle.turnRight()
- turtle.forward()
- if z ~= 1
- then
- for g=1, z-1
- do turtle.down()
- end
- end
- for i=1 , y-1
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- drop()
- sleep(.1)
- if z~=1
- then
- for g=1, z-1
- do turtle.up()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=1 , y
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- turtle.turnRight()
- end
- function back() --goes back when turtle is facing forward and empties inventory
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- if z ~= 1
- then
- for g=1, z-1
- do turtle.down()
- end
- end
- for i=1 , y-1
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- drop()
- sleep(.1)
- if z~=1
- then
- for g=1, z-1
- do turtle.up()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=1 , y
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- end
- function dig() --this is to protect against gravel and sand
- while turtle.dig()
- do
- turtle.dig()
- sleep(.2)
- end
- end
- function digup() --this is to protect against gravel and sand above
- while turtle.digUp()
- do
- turtle.digUp()
- sleep(.3)
- end
- end
- function checkbackL() --this will check inventory and if it is full will go back
- if
- turtle.getItemCount(1)>0
- and
- turtle.getItemCount(2)>0
- and
- turtle.getItemCount(3)>0
- and
- turtle.getItemCount(4)>0
- and
- turtle.getItemCount(5)>0
- and
- turtle.getItemCount(6)>0
- and
- turtle.getItemCount(7)>0
- and
- turtle.getItemCount(8)>0
- and
- turtle.getItemCount(9)>0
- and
- turtle.getItemCount(10)>0
- and
- turtle.getItemCount(11)>0
- and
- turtle.getItemCount(12)>0
- and
- turtle.getItemCount(13)>0
- and
- turtle.getItemCount(14)>0
- and
- turtle.getItemCount(15)>0
- and
- turtle.getItemCount(16)>0
- then backL()
- end
- end
- function checkbackR()
- if
- turtle.getItemCount(1)>0
- and
- turtle.getItemCount(2)>0
- and
- turtle.getItemCount(3)>0
- and
- turtle.getItemCount(4)>0
- and
- turtle.getItemCount(5)>0
- and
- turtle.getItemCount(6)>0
- and
- turtle.getItemCount(7)>0
- and
- turtle.getItemCount(8)>0
- and
- turtle.getItemCount(9)>0
- and
- turtle.getItemCount(10)>0
- and
- turtle.getItemCount(11)>0
- and
- turtle.getItemCount(12)>0
- and
- turtle.getItemCount(13)>0
- and
- turtle.getItemCount(14)>0
- and
- turtle.getItemCount(15)>0
- and
- turtle.getItemCount(16)>0
- then backR()
- end
- end
- function checkback()
- if
- turtle.getItemCount(1)>0
- and
- turtle.getItemCount(2)>0
- and
- turtle.getItemCount(3)>0
- and
- turtle.getItemCount(4)>0
- and
- turtle.getItemCount(5)>0
- and
- turtle.getItemCount(6)>0
- and
- turtle.getItemCount(7)>0
- and
- turtle.getItemCount(8)>0
- and
- turtle.getItemCount(9)>0
- and
- turtle.getItemCount(10)>0
- and
- turtle.getItemCount(11)>0
- and
- turtle.getItemCount(12)>0
- and
- turtle.getItemCount(13)>0
- and
- turtle.getItemCount(14)>0
- and
- turtle.getItemCount(15)>0
- and
- turtle.getItemCount(16)>0
- then back()
- end
- end
- --main body use check() to set n to true or false then use "" to make sure progam knows what it is
- print("How long of a tunnel do you want? (must be a multiple of 2)")
- y=1
- x=read()
- for i=1, x/2
- do
- z=1
- dig()
- checkback()
- sleep(0.1)
- turtle.forward()
- y=y+1
- sleep(.1)
- turtle.turnRight()
- sleep(.1)
- dig()
- checkbackR()
- sleep(.1)
- turtle.turnLeft()
- turtle.turnLeft()
- sleep(.1)
- dig()
- checkbackL()
- sleep(.1)
- digup()
- checkbackL()
- sleep(.1)
- turtle.up()
- z=2
- sleep(.1)
- dig()
- checkbackL()
- sleep(.1)
- turtle.turnRight()
- turtle.turnRight()
- sleep(.1)
- dig()
- checkbackR()
- sleep(.1)
- digup()
- checkbackR()
- sleep(.1)
- turtle.up()
- z=3
- sleep(.1)
- dig()
- checkbackR()
- sleep(.1)
- turtle.turnLeft()
- turtle.turnLeft()
- sleep(.1)
- dig()
- checkbackL()
- sleep(.1)
- turtle.turnRight()
- sleep(.1)
- dig()
- checkback()
- sleep(.1)
- turtle.forward()
- y=y+1
- sleep(.1)
- turtle.turnRight()
- sleep(.1)
- dig()
- checkbackR()
- turtle.turnLeft()
- turtle.turnLeft()
- sleep(.1)
- dig()
- checkbackL()
- sleep(.1)
- turtle.digDown()
- checkbackL()
- sleep(.1)
- turtle.down()
- z=2
- sleep(.1)
- dig()
- checkbackL()
- sleep(.1)
- turtle.turnRight()
- turtle.turnRight()
- sleep(.1)
- dig()
- checkbackR()
- sleep(.1)
- turtle.digDown()
- checkbackR()
- sleep(.1)
- turtle.down()
- z=1
- sleep(.1)
- dig()
- checkbackR()
- sleep(.1)
- turtle.turnLeft()
- turtle.turnLeft()
- sleep(.1)
- dig()
- checkbackL()
- sleep(.1)
- turtle.turnRight()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=1 , y
- do
- if turtle.forward()
- then turtle.forward()
- else
- turtle.attack()
- sleep(.2)
- turtle.forward()
- end
- end
- drop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement