Advertisement
s3ptum

mine3

Aug 4th, 2020
1,597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1.  
  2. --varibles
  3. --local binput = tonumber( read() ) --length of cycle
  4. --local tinput = tonumber( read() )  --number of cycles
  5. --local i = 1
  6.  
  7. --Opening dialogue
  8. write("Welcome!")
  9. sleep(2)
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. write("Please place fuel in first slot and torches in second slot.")
  13. sleep(3)
  14. term.clear()
  15.  
  16. --Begin Input Request
  17. term.setCursorPos(1,1)
  18. write("How many blocks between torches?")
  19. local binput = tonumber( read() )
  20. term.clear()
  21. term.setCursorPos(1,1)
  22. write("How many cycles i.e. torches?")
  23. local tinput = tonumber( read() )
  24. term.clear()
  25. term.setCursorPos(1,1)
  26. write("Thank You!")
  27.  
  28. --check fuel and refuel
  29. function getFuel()
  30. if turtle.getFuelLevel() < 100 then
  31.         turtle.select(1)
  32.         turtle.refuel()
  33.     else term.setCursorPos(1,1) write("Out of Fuel!")
  34. end
  35. end
  36.  
  37.        
  38. --dig enough space for steve to step through
  39. function mine()
  40.     turtle.dig()
  41.     turtle.digUp()
  42. end
  43.  
  44. --Check if required space for steve is available and locomotion.
  45. function moveCheck()
  46.     turtle.forward()
  47.     turtle.up()
  48.     turtle.down()
  49. end
  50.  
  51. --Place torch.
  52. function torch() --Place torch.
  53.         turtle.select(2)
  54.         turtle.place()
  55. end
  56.  
  57. --Turn around.
  58. function turnAround()
  59.     turtle.turnLeft()
  60.     turtle.turnLeft()
  61. end
  62.  
  63. --Place Torch
  64. function placeTorch()
  65.     turnAround()
  66.     torch()
  67.     turnAround()
  68. end
  69.  
  70. --Begin Program
  71. --get fuel before we begin
  72. getFuel()
  73.  
  74. --Move until hit block then mine.
  75. local i = 1
  76. repeat 
  77.     i = 0
  78.     moveCheck()
  79.     until i == binput * tinput
  80.  
  81.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement