Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function place ()
- turtle.select(1)
- turtle.dig()
- turtle.place()
- turtle.up()
- turtle.select(2)
- turtle.placeDown()
- turtle.dig()
- turtle.select(3)
- turtle.place()
- turtle.select(4)
- turtle.placeUp()
- end
- function remove ()
- turtle.select(3)
- turtle.dig()
- turtle.select(2)
- turtle.digDown()
- turtle.down()
- turtle.select(1)
- turtle.dig()
- end
- function gotoNextPos (turnRight)
- if turnRight == true then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- for i = 1,9 do
- move()
- end
- turtle.turnLeft()
- end
- function move ()
- if turtle.forward() == false then
- turtle.select(5)
- turtle.dig()
- if turtle.forward() == false then
- print("Unable to move, quiting....")
- else
- turtle.drop()
- end
- end
- end
- local args = { ... }
- local quit = false
- if not #args == 1 then
- print("Usage: program <times to run>")
- else
- total = tonumber(args[1])
- i = 0
- while i < total do
- i = i + 1
- if quit == true then
- break
- end
- if turtle.getFuelLevel() < 200 then
- turtle.select(6)
- turtle.digUp()
- turtle.drop()
- turtle.select(5)
- turtle.placeUp()
- turtle.suckUp()
- turtle.refuel(10)
- turtle.dropUp()
- turtle.digUp()
- end
- place()
- if i > 1 then
- turtle.select(4)
- gotoNextPos(false)
- turtle.digUp()
- gotoNextPos(false)
- end
- itemsInInv = 0
- sleep(10)
- write("Waiting for quarry to finish...")
- while itemsInInv < 10 do
- turtle.select(6)
- if turtle.suck() then
- turtle.drop()
- sleep(10)
- else
- itemsInInv = itemsInInv + 1
- sleep(5)
- end
- end
- write("Detected that chest is empty")
- remove()
- if i < total then
- gotoNextPos(true)
- else
- turtle.up()
- turtle.select(4)
- turtle.dig()
- turtle.down()
- end
- print("iteration - " .. i)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment