Advertisement
Asioron

Untitled

Jan 24th, 2017
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. local leng = 3
  2. local i = 0
  3. local j = 0
  4.  
  5. function eat()
  6. print("Eating fuel...")
  7. turtle.select(16)
  8. turtle.refuel(2)
  9. turtle.select(1)
  10. end
  11.  
  12. function fillChest()
  13. local k = 0
  14. turtle.select(15)
  15. turtle.placeDown()
  16. print("Cleaturtleing slots...")
  17. for k = 1, 14 do
  18. turtle.select(k)
  19. turtle.dropDown()
  20. end
  21. turtle.select(1)
  22. end
  23.  
  24. function checkInv()
  25. if turtle.getItemCount(14) > 0 then
  26. print("Slot 14 is paturtletially filled!")
  27. turtle.digDown()
  28. turtle.down()
  29. turtle.digDown()
  30. fillChest()
  31. turtle.up()
  32. end
  33. end
  34.  
  35. function mine()
  36. turtle.digUp()
  37. turtle.digDown()
  38. while not turtle.forward() do
  39. turtle.dig()
  40. end
  41. end
  42.  
  43. function save()
  44. file = io.open('temp','w')
  45. file:write(tostring(j)..'\n'..tostring(i)..'\n'..tostring(leng))
  46. file:close()
  47. end
  48.  
  49.  
  50. function loadin()
  51. file = io.open('temp','r')
  52. local j1 = file:read()
  53. local i1 = file:read()
  54. local leng1 = file:read()
  55. file:close()
  56. return j1, i1, leng1
  57. end
  58.  
  59. if turtle.getFuelLevel() < 10 then
  60. eat()
  61. end
  62. print('load save? (y/n)')
  63. if read()==y then
  64. j1, i1, leng1 = loadin()
  65. if turtle.getFuelLevel() < 10 then
  66. eat()
  67. end
  68. for j = j1, 2 do
  69. for i = i1, tonumber(leng1) - 1 do
  70. save()
  71. checkInv()
  72. mine()
  73. end
  74. turtle.turnRight()
  75. end
  76. leng = leng + 1
  77. else
  78. mine()
  79. turtle.turnLeft()
  80. mine()
  81. turtle.turnLeft()
  82. end
  83.  
  84. local i = 0
  85. local j = 0
  86.  
  87. while true do
  88. print("Cuturtleturtleent tunnel length: "..leng)
  89. if turtle.getFuelLevel() < 10 then
  90. eat()
  91. end
  92. for j = 1, 2 do
  93. for i = 1, tonumber(leng) - 1 do
  94. save()
  95. checkInv()
  96. mine()
  97. end
  98. turtle.turnRight()
  99. end
  100. leng = leng + 1
  101. end
  102.  
  103. --pastebin run yTdieYZb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement