Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- saplingSlot = 1
- function drop_all_items()
- for i = 2, 15 do
- turtle.select(i)
- turtle.dropDown( turtle.getItemCount(i) )
- sleep(0.5)
- end
- turtle.select( saplingSlot )
- end
- function cutUp()
- turtle.digUp()
- turtle.up()
- end
- function cutDown()
- turtle.digDown()
- turtle.down()
- end
- function run()
- local height = 0
- turtle.select( saplingSlot )
- -- chop down the first block
- turtle.dig()
- turtle.forward() -- ]]
- while turtle.digUp()==true do
- turtle.dig()
- turtle.up()
- height = height + 1 --count height of the tree
- end
- turtle.turnRight(); turtle.dig(); turtle.forward(); turtle.turnLeft()
- for i=1, height do
- cutDown()
- turtle.dig()
- end
- --print("End of tree or no blocks found. End of while")
- turtle.place()
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.turnLeft()
- turtle.place()
- turtle.back()
- turtle.place()
- drop_all_items()
- print("Jobs done! Current height: " ..height)
- end
- while true do
- print("while")
- if turtle.compare()==true then --sleep if it's the sapling
- sleep(15)
- else
- run()
- break --you may replace this with sleep(120)
- --so the turtle runs full automatically
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement