Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. require "CiderDebugger";
  2. local cobblenumber = turtle.getItemcount(1)
  3. local torchnumber = turtle.getItemcount(2)
  4. local data = turtle.getItemDetail(1)
  5. local data2 = turtle.getItemDetail(2)
  6. local dataname = data.name
  7. local dataneme = data2.name
  8. local lenght = 0
  9. local times = 0
  10. local direction = 2
  11. local onlight = 0
  12.  
  13. function insert1()
  14. print("length:")
  15. input = io.read()
  16. lenght = tonumber(input)
  17. print("direction:")
  18. input2 = io.read()
  19. direction = tonumber(input2)
  20. print("direciton")
  21. input3 = io.read()
  22. times = tonumber(input3)
  23.  
  24. end
  25. function Fuel()
  26. fuelevel = turtle.getFuelLevel()
  27. if fuellevel ~= "unlimited" and fuelevel < 1 then
  28. if turtle.refuel(3) then
  29. print("refulling")
  30. else print("No Fuel")
  31. os.shutdown()
  32. end
  33. end
  34. end
  35. function check()
  36. if cobblenumber > 1 then
  37. print("Please put cobble")
  38. end
  39. if torchnumber > 1 then
  40. print("Please put torches")
  41. end
  42. if dataname ~= Cobblestone then
  43. print("Please put cobble")
  44. end
  45. if dataname ~= Torches then
  46. print("Please put torches")
  47. end
  48. end
  49. function forward()
  50. for i=lenght, 1
  51. Fuel()
  52. while turtle.detect() do
  53. turtle.dig()
  54. end
  55. while turtle.detectUp() do
  56. turtle.digUp()
  57. end
  58. while turtle.detectDown = false do
  59. turtle.select(1)
  60. turtle.placeDown()
  61. end
  62. turtle.forward()
  63. onlight = onlight + 1
  64. if onlight = 7 then
  65. turtle.placeDown(2)
  66. onlight = onlight - 7
  67. end
  68. end
  69. end
  70.  
  71. function returN()
  72. turtle.turnLeft
  73. turtle.turnLeft
  74. for i=lenght, 1
  75. turtle.forward()
  76. end
  77. end
  78.  
  79. function times()
  80. for i = times, 1
  81. fuel()
  82. forward()
  83. onlight = 0
  84. returN()
  85. if direction = 1 then
  86. turtle.turnLeft()
  87. end
  88. if direction = 0 then
  89. turtle.turnRight()
  90. end
  91. while turtle.detect() do
  92. turtle.dig()
  93. end
  94. while turtle.detectUp()
  95. turtle.digUp()
  96. end
  97. turtle.forward()
  98. turtle.forward()
  99. if direction = 1 then
  100. turtle.turnLeft()
  101. end
  102. if direction = 0 then
  103. turtle.turnRight()
  104. end
  105. end
  106. end
  107. function start()
  108. insert()
  109. fuel()
  110. check()
  111. times()
  112. end
  113.  
  114. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement