Zoidbergie

Untitled

Jul 17th, 2019
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. --Local
  2. local miningError = 0 -- 0 = no error, 1 = error
  3. local torch = turtle.getItemCount(1)
  4.  
  5. --Check
  6. local function Check()
  7. if torch == 0 then
  8. print("Missing torches in slot 1")
  9. Error = 1
  10. else
  11. print("Torches detected")
  12.  
  13. end
  14. end
  15.  
  16. -- Recheck
  17. local function Recheck()
  18. torch = turtle.getItemCount(1)
  19. Error = 0
  20. end
  21.  
  22. --Dig
  23. local function DigUpDown()
  24. turtle.digUp()
  25. turtle.digDown()
  26. end
  27.  
  28. --Forward
  29. local function Forward()
  30. turtle.dig()
  31. turtle.forward()
  32. end
  33.  
  34. --TurnLeft
  35. local function TurnLeft()
  36. turtle.turnLeft()
  37. end
  38.  
  39. --TurnRight
  40. local function TurnRight()
  41. turtle.turnRight()
  42. end
  43.  
  44. --Down
  45. local function Down()
  46. turtle.down()
  47. end
  48.  
  49. --3x3
  50. local function ThreeXThree()
  51. Forward()
  52. DigUpDown()
  53. TurnLeft()
  54. Forward()
  55. DigUpDown()
  56. TurnRight()
  57. TurnRight()
  58. Forward()
  59. Forward()
  60. DigUpDown()
  61. TurnLeft()
  62. TurnLeft()
  63. Forward()
  64. TurnRight()
  65. end
  66.  
  67. -- Start
  68. local function Start()
  69. ThreeXThree()
  70. ThreeXThree()
  71. Down()
  72. end
  73.  
  74. -- Main
  75. print("Welcome to stairs program place turtle in the bottom middle tile")
  76. sleep(2)
  77. print("Place torches in slot 1 and fuel in any other slot")
  78. sleep(5)
  79. print("How deep do you want to go ?")
  80. input = io.read()
  81. turtle.refuel()
  82. Check()
  83. if Error == 1 then
  84. repeat
  85. sleep(10)
  86. Recheck()
  87. Check()
  88. until Error == 0
  89. end
  90.  
  91. if input > 0 then
  92. repeat
  93. Start()
  94. input = input - 1
  95. until input == 0
  96. end
Add Comment
Please, Sign In to add comment