Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. round = 1
  2. max = 5
  3.  
  4. function pickUp()
  5. for i = 0, 5 do turtle.suck(99) end
  6. for i = 0, 5 do turtle.suckUp(99) end
  7. for i = 0, 5 do turtle.suckDown(99) end
  8. end
  9.  
  10. while (round < max) do
  11. for rot = 0, 3 do
  12. -- First, up
  13. success, data = turtle.detectUp()
  14. if success then
  15. if string.match(data["name"], "ore") then
  16. turtle.digUp()
  17. sleep(1)
  18. pickUp()
  19. end
  20. end
  21.  
  22. -- Next, down
  23. success, data = turtle.detectUp()
  24. if success then
  25. if string.match(data["name"], "ore") then
  26. turtle.digUp()
  27. sleep(1)
  28. pickUp()
  29. end
  30. end
  31.  
  32. -- Last, forward
  33. success, data = turtle.detectUp()
  34. if success then
  35. if string.match(data["name"], "ore") then
  36. turtle.digUp()
  37. sleep(1)
  38. pickUp()
  39. end
  40. end
  41.  
  42. -- Move forward
  43. turtle.forward()
  44. end
  45.  
  46. round = round + 1
  47. turtle.turnLeft()
  48. print("Round", round, "done")
  49. end
  50.  
  51. print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement