SummitSummit

autoChop

Apr 5th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. local count = 0
  2. local trees = 0
  3.  
  4. function Chop()
  5. turtle.dig()
  6. turtle.forward()
  7. while turtle.detectUp() or turtle.detect() do
  8. turtle.digUp()
  9. turtle.dig()
  10. turtle.up()
  11. count = count + 1
  12. end
  13. turtle.turnRight()
  14. turtle.dig()
  15. turtle.forward()
  16. turtle.turnLeft()
  17. turtle.dig()
  18. while count > 0 do
  19. turtle.digDown()
  20. turtle.down()
  21. turtle.dig()
  22. count = count - 1
  23. end
  24. end
  25.  
  26. function clearInv()
  27. for i = 1, 8 do
  28. turtle.select(i)
  29. turtle.dropDown()
  30. end
  31. turtle.select(16)
  32. end
  33.  
  34. function replant()
  35. turtle.select(15)
  36. turtle.place()
  37. turtle.back()
  38. turtle.place()
  39. turtle.turnLeft()
  40. turtle.forward()
  41. turtle.turnRight()
  42. turtle.forward()
  43. turtle.place()
  44. turtle.back()
  45. turtle.place()
  46. end
  47.  
  48. function bonemeal()
  49. if turtle.getItemCount(16) > 0 then
  50. grow()
  51. else print("Out of bonemeal.")
  52. end
  53. end
  54.  
  55. function grow()
  56. turtle.select(15)
  57. while turtle.compare() == true do
  58. print("Sapling.")
  59. turtle.select(16)
  60. turtle.place()
  61. sleep(10)
  62. turtle.select(15)
  63. end
  64. end
  65.  
  66. function wait()
  67. turtle.select(15)
  68. while turtle.compare() == true do
  69. print("Still a sapling...")
  70. sleep(60)
  71. end
  72. print("The tree finally grew, gotta chop it down!")
  73. turtle.select(1)
  74. autoChop()
  75. end
  76.  
  77. function autoChop()
  78. --while true do
  79. Chop()
  80. replant()
  81. clearInv()
  82. --grow()
  83. --bonemeal()
  84. trees = trees + 1
  85. print("Trees murdered: "..trees)
  86. end
  87. end
  88.  
  89. wait()
Advertisement
Add Comment
Please, Sign In to add comment