Saereth

TestCut

May 20th, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function f(loc)
  2. while not turtle[loc]() do
  3. sleep(0.5)
  4. end
  5. end
  6. function up() f("up") end
  7. function down() f("down") end
  8. function fw() f("forward") end
  9. function back() f("back") end
  10. function l() f("turnLeft") end
  11. function r() f("turnRight") end
  12. function d() turtle.dig() end
  13. function du() turtle.digUp() end
  14. function dd() turtle.digDown() end
  15. function c(x)
  16. for i=1,x do d() fw() du() dd() end
  17. end
  18.  
  19. function cutTree()
  20. print("tree cut")
  21. hi = 0
  22. while not turtle.detectUp() do
  23. up() hi=hi+1
  24. end
  25. du() up() du() up() du() l() l()
  26. c(1) r() c(2) r() c(4) r() c(4) r()
  27. c(4) r() c(1) r() c(3) l() c(2) l()
  28. c(2) back() l() c(1) l() down()
  29. for r=1,hi do dd() down() end
  30. dd() turtle.placeDown() back()
  31. down() down()
  32. print(hi)
  33. end
  34.  
  35. cutTree()
  36. end
Advertisement
Add Comment
Please, Sign In to add comment