Guest User

advTunnel V2

a guest
Jan 19th, 2013
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. local tArgs = {...}
  2. local count = 0
  3. local Version = "V2"
  4.  
  5. local torch = 10
  6.  
  7. function fuelCheck()
  8. if turtle.getFuelLevel() < 50 then
  9. -- print(tostring(turtle.getFuelLevel()))
  10. turtle.select(16)
  11. turtle.refuel(1)
  12. turtle.select(1)
  13. end
  14. end
  15.  
  16. function placeTorch()
  17. count = count + 1
  18. -- print(tostring(count))
  19. if count == torch then
  20. turtle.select(15)
  21. turtle.turnRight()
  22. turtle.place()
  23. turtle.turnLeft()
  24. turtle.select(1)
  25. count = 0
  26. end
  27. end
  28.  
  29. function checkInv()
  30. for i = 1, 13 do
  31. if turtle.getItemCount(i) ~= 64 then
  32. turtle.select(16)
  33. else
  34. emptyInv()
  35. end
  36. end
  37. end
  38.  
  39. function emptyInv()
  40. turtle.select(14)
  41. turtle.turnLeft()
  42. turtle.place()
  43. turtle.attack()
  44. for i = 1,13 do
  45. turtle.select(i)
  46. turtle.drop()
  47. end
  48. turtle.select(14)
  49. turtle.dig()
  50. turtle.select(1)
  51. turtle.turnRight()
  52. end
  53.  
  54. if #tArgs ~= 1 then
  55. print("Useage advTunnel <dist>")
  56. return
  57. end
  58.  
  59. print("Version: "..Version.." \nPlease make Sure to have a Enderchest in Slot 14 Torches in Slot 15 and Fuel in Slot 16")
  60. print("You have chosen to go "..tArgs[1].." blocks ahead")
  61.  
  62. for i = 1, tArgs[1] do
  63. fuelCheck()
  64. checkInv()
  65. while not turtle.forward() do
  66. turtle.dig()
  67. sleep(0.6)
  68. end
  69. turtle.turnLeft()
  70. turtle.dig()
  71. turtle.digUp()
  72. if not turtle.up() then
  73. turtle.digUp()
  74. end
  75. turtle.dig()
  76. turtle.digUp()
  77. turtle.up()
  78. turtle.dig()
  79. turtle.turnRight()
  80. turtle.turnRight()
  81. turtle.dig()
  82. turtle.down()
  83. turtle.dig()
  84. turtle.down()
  85. turtle.dig()
  86. turtle.turnLeft()
  87. placeTorch()
  88. end
  89. emptyInv()
  90. turtle.back()
  91. turtle.back()
  92. term.clear()
  93. term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment