Advertisement
Dima99

Wall2

Jul 6th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.51 KB | None | 0 0
  1. a = 0
  2. print("What distanse")
  3. a = read()
  4.  
  5. b = ""
  6. print("Where should I go after work?")
  7. print("Right or left?")
  8. b = read()
  9.  
  10. c = ""
  11. f = ""
  12. g = true
  13. print("Should I place torches?")
  14. print("Yes or no?")
  15. c = read()
  16. if c == "Yes" then
  17. print("Where must I place torches?")
  18. print("Left or right?")
  19. f = read()
  20. if turtle.getItemCount(16) < 1 then
  21. while g do
  22. if turtle.getItemCount(16) < 1 then
  23. print("Place some torches in the 16th slot")
  24. sleep(1)
  25. term.clear()
  26. term.setCursorPos(1, 1)
  27. sleep(1)
  28. else g = false
  29. end
  30. end
  31. end
  32. end
  33.  
  34. d = "Yes"
  35. --print("Should I clean place?")
  36. --print("Yes or no?")
  37. --d = read()
  38.  
  39. function slot()
  40. e = true
  41. if turtle.getItemCount(4) >= 3 then
  42. turtle.select(4)
  43. elseif turtle.getItemCount(3) >= 3 then
  44. turtle.select(3)
  45. elseif turtle.getItemCount(2) >= 3 then
  46. turtle.select(2)
  47. elseif turtle.getItemCount(1) >= 3 then
  48. turtle.select(1)
  49. else
  50. while e do
  51. if turtle.getItemCount(1) < 3 then
  52. print("Place some resourses in the first slot")
  53. sleep(1)
  54. term.clear()
  55. term.setCursorPos(1, 1)
  56. sleep(1)
  57. else e = false
  58. slot()
  59. end
  60. end
  61. end
  62. end
  63.  
  64. function torch()
  65. if f == "Left" then
  66. turtle.turnLeft()
  67. turtle.forward()
  68. turtle.turnLeft()
  69. turtle.select(16)
  70. turtle.place()
  71. turtle.turnLeft()
  72. turtle.forward()
  73. turtle.turnLeft()
  74. elseif f == "Right" then
  75. turtle.turnRight()
  76. turtle.forward()
  77. turtle.turnRight()
  78. turtle.select(16)
  79. turtle.place()
  80. turtle.turnRight()
  81. turtle.forward()
  82. turtle.turnRight()
  83. end
  84. end
  85.  
  86. function clean()
  87. turtle.dig()
  88. turtle.forward()
  89. turtle.digUp()
  90. turtle.digDown()
  91. end
  92.  
  93. function step()
  94. slot()
  95. turtle.placeDown()
  96. turtle.placeUp()
  97. turtle.turnRight()
  98. turtle.turnRight()
  99. turtle.place()
  100. turtle.turnRight()
  101. turtle.turnRight()
  102. end
  103.  
  104. function ending()
  105. if b == "Right" then
  106. turtle.turnRight()
  107. turtle.forward()
  108. turtle.turnRight()
  109. turtle.turnRight()
  110. slot()
  111. turtle.place()
  112. elseif b == "Left" then
  113. turtle.Left()
  114. turtle.forward()
  115. turtle.turnLeft()
  116. turtle.turnLeft()
  117. slot()
  118. turtle.place()
  119. end
  120. end
  121.  
  122. function begin()
  123. if b == "Right" then
  124. turtle.dig()
  125. turtle.forward()
  126. turtle.turnRight()
  127. elseif b == "Left" then
  128. turtle.dig()
  129. turtle.forward()
  130. turtle.turnLeft()
  131. end
  132. end
  133.  
  134. if d == "Yes" then
  135. h = 1
  136. begin()
  137. turtle.digUp()
  138. turtle.digDown()
  139. slot()
  140. turtle.placeDown()
  141. turtle.placeUp()
  142. for i = 1, a do
  143. clean()
  144. step()
  145. h = h + 1
  146. if h == 3 then
  147. torch()
  148. h = 0
  149. end
  150. end
  151. elseif d == "No" then
  152. slot()
  153. turtle.placeDown()
  154. turtle.placeUp()
  155. for i = 1, a do
  156. step()
  157. turtle.forward()
  158. h = h + 1
  159. if h == 3 then
  160. torch()
  161. h = 0
  162. end
  163. end
  164. end
  165. ending()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement