Advertisement
Zoidbergie

Untitled

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