Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.write("Current level? ")
- level = read()
- term.write("Length? ")
- length = read()
- term.write("Width? ")
- width = read()
- function goDig()-- Order of Operations
- for i=1, level/3 do
- depth = i
- wide()
- for w=1, 3 do
- while not turtle.down()do
- turtle.digDown()
- end
- end
- end
- end
- function wide()
- for i=1, width / 2 do
- current = i
- goLine()
- turnLeft()
- goLine()
- if turtle.getItemCount(14)>0 then --returns ore if slot 14 is occupied
- turtle.turnLeft()
- for p=1, i do
- turtle.forward()
- end
- for u=1, depth do
- turtle.up()
- end
- for x=4,16 do
- turtle.select(x)
- turtle.drop()
- end
- for a=1, depth do
- turtle.down()
- end
- turtle.turnRight()
- turtle.turnRight()
- for s=1, current do
- turtle.forward()
- end
- turtle.turnRight()
- else turtle.turnRight()
- while not turtle.forward()do
- turtle.dig()
- end
- turtle.turnRight()
- end
- end
- if current==width/2 then
- turtle.turnRight()
- for i=1, current do
- turtle.forward()
- end
- turtle.turnleft()
- end
- end
- function goLine()
- for j=1, length do
- compareToOre()
- while not turtle.forward() do
- turtle.dig()
- end
- dropTrash()
- end
- end
- --FUNCTIONS FOR GOLINE
- function compareToOre()--detects ore on ceiling and floor and mines
- for k=1, 3 do
- turtle.select(i)
- if not turtle.compareUp()then
- turtle.digUp()
- end
- if not turtle.compareDown()then
- turtle.digDown()
- end
- end
- end
- function dropTrash()--finds cobble/(slot 1)
- turtle.digDown()
- for i=4,16 do
- turtle.select(i)
- if turtle.compareTo(1) then
- turtle.dropDown()
- elseif turtle.compareTo(2)then
- turtle.dropDown()
- elseif turtle.compareTo(3)then
- turtle.dropDown()
- end
- end
- for j=1,3 do--sets trash slots to 1
- turtle.select(j)
- turtle.dropDown(turtle.getItemCount(j)-1)
- end
- end
- function turnLeft()
- turtle.turnLeft()
- while not turtle.forward()do
- turtle.dig()
- end
- turtle.turnLeft()
- end
- function turnRight()
- turtle.turnRight()
- while not turtle.forward()do
- turtle.dig()
- end
- end
- --END FUNCTIONS FOR GOLINE
Advertisement
Add Comment
Please, Sign In to add comment