Advertisement
Guest User

choptree

a guest
Mar 31st, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. --[[Tree Chopping program by Al Sweigart
  2. Chops down the tree in front of turtle.]]
  3.  
  4. if not turtle.detect() then
  5.   error('Could not find tree!')
  6. end
  7.  
  8. print('Chopping tree...')
  9.  
  10.  
  11. if not turtle.dig() then -- chop base of tree
  12.   error('Turtle needs a digging tool!')
  13. end
  14.  
  15. turtle.forward() --move under tree
  16. while turtle.compareUp() do
  17.   --keep chopping until no more wood
  18.   turtle.digUp()
  19.   turtle.up()
  20. end
  21.  
  22. --move back down to ground
  23. while not turtle.detectDown() do
  24.   turtle.down()
  25. end
  26.  
  27. print('Done chopping tree.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement