Advertisement
Zoidbergie

Untitled

Jul 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 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. -- Start
  52. local function Start()
  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. turnRight()
  66. end
  67.  
  68.  
  69.  
  70.  
  71.  
  72. -- Main
  73. print("Welcome to stairs program place turtle in the bottom middle tile")
  74. sleep(2)
  75. print("Place torches in slot 1")
  76. sleep(10)
  77. Check()
  78. if Error == 1 then
  79. repeat
  80. sleep(10)
  81. Recheck()
  82. Check()
  83. until Error == 0
  84. end
  85. Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement