Advertisement
s3ptum

mine3

Aug 4th, 2020
1,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 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. term.write("Welcome!")
  9. sleep(1)
  10. term.clear()
  11. term.write("Please place fuel in first slot and torches in second slot.")
  12. sleep(1)
  13. term.clear()
  14.  
  15. --Begin Input Request
  16. term.write("How many blocks between torches?")
  17. local binput = tonumber( read() )
  18. term.clear()
  19. term.write("How many cycles i.e. torches?")
  20. local tinput = tonumber( read() )
  21. term.clear()
  22. term.write("Thank You!")
  23.  
  24.  
  25. --dig enough space for steve to step through
  26. function mine()
  27.     turtle.dig()
  28.     turtle.digUp()
  29. end
  30.  
  31. --Check if required space for steve is available and locomotion.
  32. function moveCheck()
  33.     turtle.forward()
  34.     turtle.up()
  35.     turtle.down()
  36. end
  37.  
  38. --Place torch.
  39. function torch() --Place torch.
  40.         turtle.select(16)
  41.         turtle.place()
  42. end
  43.  
  44. --Turn around.
  45. function turnAround()
  46.     turtle.turnLeft()
  47.     turtle.turnLeft()
  48. end
  49.  
  50. function placeTorch()
  51.     turnAround()
  52.     torch()
  53.     turnAround()
  54. end
  55.  
  56. --Move until hit block then mine.
  57. function digMove()
  58.     for i = 1, binput + 1 do
  59.         while not moveCheck() do
  60.             mine()
  61.         end  
  62.     end  
  63. end    
  64.  
  65. for i = 1, tinput, 1 do
  66.         while not digMove() do
  67.             placeTorch()
  68.             end
  69.     end
  70.    
  71.    
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement