Advertisement
Zoidbergie

Untitled

Jul 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 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. refuel all
  18. else
  19. print("No fuel to add, hope you have enough =P")
  20. end
  21.  
  22. -- Recheck
  23. local function Recheck()
  24. torch = turtle.getItemCount(1)
  25. Error = 0
  26. end
  27.  
  28. --Dig
  29. local function DigUpDown()
  30. turtle.digUp()
  31. turtle.digDown()
  32. end
  33.  
  34. --Forward
  35. local function Forward()
  36. turtle.dig()
  37. turtle.forward()
  38. end
  39.  
  40. --TurnLeft
  41. local function TurnLeft()
  42. turtle.turnLeft()
  43. end
  44.  
  45. --TurnRight
  46. local function TurnRight()
  47. turtle.turnRight()
  48. end
  49.  
  50. -- Start
  51. local function Start()
  52. Forward()
  53. DigUpDown()
  54. TurnLeft()
  55. Forward()
  56. DigUpDown()
  57. TurnRight()
  58. TurnRight()
  59. Forward()
  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