xxangel17xx

logger-with refuel

Nov 4th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. --defines how many tree to harvest
  2. local times = 0
  3. term.write("Number of trees to cut: ")
  4. times = read()
  5. for u = 1, times do
  6. -- sets a vari for use when cutting the tree
  7. local x = 0
  8. --fueles the turtle
  9. function checkFuel()
  10. if turtle.getFuelLevel() <= 10 --or any number, depending on how frequently you check, and how much the turtle moves.
  11. turtle.select(1) --fuel goes in this slot
  12. turtle.refuel(1)
  13. turtle.select(2) --use any slot here, I default to 2, depending on the program.
  14. end
  15. end
  16.  
  17. --plants and bonemeals the tree
  18. turtle.select(2)
  19. turtle.place()
  20. turtle.select(3)
  21. turtle.place()
  22. turtle.place()
  23. turtle.place()
  24. -- moves the turtle up
  25. while turtle.detect() do
  26.   turtle.digUp()
  27.   turtle.up()
  28.   x = x+1
  29. end
  30. --moves the turlte over the log
  31. turtle.forward()
  32. --cuts the tree and moves down depending on the vari x
  33. for i = 1, x do
  34.   turtle.digDown()
  35.   turtle.down()
  36. end
  37. -- sets vari x to 0
  38. x = 0
  39. -- moves turtle over to chest and turns it around
  40. turtle.back()
  41. turtle.turnLeft()
  42. turtle.turnLeft()
  43. -- puts any tree and saplings into the chest
  44. turtle.select(4)
  45. turtle.drop()
  46. turtle.select(5)
  47. turtle.drop()
  48. turtle.select(2)
  49. -- turns the turtle around to the start position
  50. turtle.turnLeft()
  51. turtle.turnLeft()
  52. end
Advertisement
Add Comment
Please, Sign In to add comment