teser1

Simple Tunnel

Jul 10th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function Dig()
  2. if turtle.detect()==true then
  3. repeat
  4. turtle.dig()
  5. until turtle.detect() == false
  6. end
  7. if turtle.detectUp()==true then
  8. repeat
  9. turtle.digUp()
  10. until turtle.detectUp() == false
  11. end
  12. if turtle.detectDown()==true then
  13. repeat
  14. turtle.digDown()
  15. until turtle.detectDown() == false
  16. end
  17. end
  18.  
  19. function forward()
  20. if turtle.detect() == true then
  21. repeat
  22. turtle.dig()
  23. until turtle.detect() == false
  24. end
  25. if turtle.detect() == false then
  26. turtle.forward()
  27. end
  28. end
  29.  
  30. i=0
  31. repeat
  32. Dig() until Dig()==false
  33. if Dig() == false then
  34. turtle.turnLeft()
  35. end
  36. if Dig() == false then
  37. turtle.turnRight()
  38. turtle.turnRight()
  39. end
  40. if Dig() == false then
  41. turtle.turnLeft()
  42. forward()
  43. i=i+1
  44. end
  45. until i==80
  46. end
  47. error()
Advertisement
Add Comment
Please, Sign In to add comment