Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. --Dodo Strip programm
  2.  
  3. --Variablen
  4. torch = 0
  5. usetorch = 0
  6. counter = 0
  7. h = 1
  8.  
  9. --Funktionen
  10. function torchthing()
  11. usetorch = 1
  12. print("Bitte Fackeln in Slot 2 legen")
  13. while turtle.getItemCount(2) == 0 do
  14. sleep(1)
  15. end
  16. inputtorch = turtle.getItemCount(2)
  17. inputtorch2 = inputtorch * 2
  18. print("")
  19. end
  20.  
  21. function preparing()
  22. print("Sollen Fackeln verwendet werden?[Ja][Nein]")
  23. torchread = read()
  24. if torchread == "Ja" then
  25. torchthing()
  26. end
  27. if torchread == "ja" then
  28. torchthing()
  29. end
  30.  
  31. print("Bitte in Slot 1 Kisten zur Lagerung legen")
  32. sleep(3)
  33. while turtle.getItemCount(1) == 0 do
  34. sleep(1)
  35. end
  36. print("")
  37.  
  38. print("Wie viele Gaenge sollen gegraben werden?")
  39. if usetorch == 1 then
  40. print("")
  41. write("Es koennen maximal ")
  42. write(inputtorch2)
  43. write(" gaenge gegraben werden")
  44. print("")
  45. end
  46. x = tonumber(read())
  47.  
  48. end
  49.  
  50. function torchfunc()
  51. if usetorch == 1 then
  52. if torch == 0 then
  53. turtle.back()
  54. turtle.select(2)
  55. sleep(0.2)
  56. turtle.placeUp()
  57. turtle.forward()
  58. torch = torch + 1
  59. end
  60.  
  61. if torch == 1 then
  62. torch = torch - 1
  63. end
  64. end
  65. end
  66.  
  67. function checkInv()
  68. if turtle.getItemCount(16) > 0 then
  69. turtle.select(1)
  70. turtle.digDown()
  71. turtle.placeDown()
  72.  
  73. slot = 2
  74. if usetorch == 1 then
  75. slot = slot + 1
  76. end
  77. while slot < 17 do
  78. turtle.select(slot)
  79. turtle.dropDown()
  80. slot = slot + 1
  81. end
  82. end
  83. end
  84.  
  85. function searchSaGra()
  86. sleep(0.3)
  87. while turtle.detect() == true do
  88. sleep(0.3)
  89. turtle.dig()
  90. end
  91. end
  92.  
  93. function searchSaGraUp()
  94. sleep(0.3)
  95. while turtle.detectUp() == true do
  96. sleep(0.3)
  97. turtle.digUp()
  98. end
  99. end
  100.  
  101. function tunFor()
  102. turtle.dig()
  103. searchSaGra()
  104. searchSaGraUp()
  105. turtle.forward()
  106. turtle.digUp()
  107. turtle.dig()
  108. searchSaGra()
  109. searchSaGraUp()
  110. turtle.forward()
  111. turtle.digUp()
  112. turtle.dig()
  113. torchfunc()
  114. searchSaGra()
  115. searchSaGraUp()
  116. turtle.forward()
  117. turtle.digUp()
  118. sleep(0.5)
  119. checkInv()
  120. end
  121.  
  122. function tunFor2()
  123. turtle.dig()
  124. searchSaGra()
  125. searchSaGraUp()
  126. turtle.forward()
  127. turtle.digUp()
  128. turtle.dig()
  129. searchSaGra()
  130. searchSaGraUp()
  131. turtle.forward()
  132. turtle.digUp()
  133. turtle.dig()
  134. searchSaGra()
  135. searchSaGraUp()
  136. turtle.forward()
  137. turtle.digUp()
  138. sleep(0.5)
  139. checkInv()
  140. end
  141.  
  142. function forward6()
  143. turtle.forward()
  144. turtle.forward()
  145. turtle.forward()
  146. turtle.forward()
  147. turtle.forward()
  148. turtle.forward()
  149. sleep(0.5)
  150. checkInv()
  151. end
  152.  
  153. function sideTun()
  154. turtle.turnLeft()
  155. tunFor2()
  156. tunFor2()
  157. turtle.turnLeft()
  158. turtle.turnLeft()
  159. forward6()
  160. sleep(0.5)
  161. checkInv()
  162. end
  163.  
  164. function sideTun2()
  165. tunFor2()
  166. tunFor2()
  167. turtle.turnLeft()
  168. turtle.turnLeft()
  169. forward6()
  170. turtle.turnRight()
  171. sleep(0.5)
  172. checkInv()
  173. end
  174.  
  175. --Main
  176. preparing()
  177.  
  178. while h > 0 do
  179. while x > 0 do
  180. print("")
  181. write("Es werden noch ")
  182. write(x)
  183. write(" gaenge gegraben")
  184.  
  185. tunFor()
  186. sideTun()
  187. sideTun2()
  188. x = x - 1
  189. counter = counter + 1
  190. if x == 0 then
  191. j = 0
  192. end
  193. end
  194.  
  195. if j == 0 then
  196. turtle.turnLeft()
  197. turtle.turnLeft()
  198. j = j + 1
  199. end
  200.  
  201. if counter == 0 then
  202. h = h - 1
  203. end
  204.  
  205. turtle.forward()
  206. turtle.forward()
  207. turtle.forward()
  208. counter = counter - 1
  209.  
  210. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement