Advertisement
bjohnston562

strip mine

Jul 28th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.49 KB | None | 0 0
  1. function drop() -- drops all stuff into inventory
  2. turtle.select(1)
  3. turtle.drop()
  4. turtle.select(2)
  5. turtle.drop()
  6. turtle.select(3)
  7. turtle.drop()
  8. turtle.select(4)
  9. turtle.drop()
  10. turtle.select(5)
  11. turtle.drop()
  12. turtle.select(6)
  13. turtle.drop()
  14. turtle.select(7)
  15. turtle.drop()
  16. turtle.select(8)
  17. turtle.drop()
  18. turtle.select(9)
  19. turtle.drop()
  20. turtle.select(10)
  21. turtle.drop()
  22. turtle.select(11)
  23. turtle.drop()
  24. turtle.select(12)
  25. turtle.drop()
  26. turtle.select(13)
  27. turtle.drop()
  28. turtle.select(14)
  29. turtle.drop()
  30. turtle.select(15)
  31. turtle.drop()
  32. turtle.select(16)
  33. turtle.drop()
  34. end
  35.  
  36.  
  37. function backL() --goes back when turtle is facing left and empties inventory
  38. turtle.turnLeft()
  39. turtle.forward()
  40. if z ~= 1
  41. then
  42. for g=1, z-1
  43. do turtle.down()
  44. end
  45. end
  46. for i=1 , y-1
  47. do
  48. if turtle.forward()
  49. then turtle.forward()
  50. else
  51. turtle.attack()
  52. sleep(.2)
  53. turtle.forward()
  54. end
  55. end
  56. drop()
  57. sleep(.1)
  58. if z~=1
  59. then
  60. for g=1, z-1
  61. do turtle.up()
  62. end
  63. end
  64. turtle.turnRight()
  65. turtle.turnRight()
  66. for i=1 , y
  67. do
  68. if turtle.forward()
  69. then turtle.forward()
  70. else
  71. turtle.attack()
  72. sleep(.2)
  73. turtle.forward()
  74. end
  75. end
  76. turtle.turnLeft()
  77. end
  78.  
  79.  
  80. function backR() --goes back when turtle is facing right and empties inventory
  81. turtle.turnRight()
  82. turtle.forward()
  83. if z ~= 1
  84. then
  85. for g=1, z-1
  86. do turtle.down()
  87. end
  88. end
  89. for i=1 , y-1
  90. do
  91. if turtle.forward()
  92. then turtle.forward()
  93. else
  94. turtle.attack()
  95. sleep(.2)
  96. turtle.forward()
  97. end
  98. end
  99. drop()
  100. sleep(.1)
  101. if z~=1
  102. then
  103. for g=1, z-1
  104. do turtle.up()
  105. end
  106. end
  107. turtle.turnRight()
  108. turtle.turnRight()
  109. for i=1 , y
  110. do
  111. if turtle.forward()
  112. then turtle.forward()
  113. else
  114. turtle.attack()
  115. sleep(.2)
  116. turtle.forward()
  117. end
  118. end
  119. turtle.turnRight()
  120. end
  121.  
  122.  
  123. function back() --goes back when turtle is facing forward and empties inventory
  124. turtle.turnRight()
  125. turtle.turnRight()
  126. turtle.forward()
  127. if z ~= 1
  128. then
  129. for g=1, z-1
  130. do turtle.down()
  131. end
  132. end
  133. for i=1 , y-1
  134. do
  135. if turtle.forward()
  136. then turtle.forward()
  137. else
  138. turtle.attack()
  139. sleep(.2)
  140. turtle.forward()
  141. end
  142. end
  143. drop()
  144. sleep(.1)
  145. if z~=1
  146. then
  147. for g=1, z-1
  148. do turtle.up()
  149. end
  150. end
  151. turtle.turnRight()
  152. turtle.turnRight()
  153. for i=1 , y
  154. do
  155. if turtle.forward()
  156. then turtle.forward()
  157. else
  158. turtle.attack()
  159. sleep(.2)
  160. turtle.forward()
  161. end
  162. end
  163. end
  164.  
  165.  
  166. function dig() --this is to protect against gravel and sand
  167. while turtle.dig()
  168. do
  169. turtle.dig()
  170. sleep(.2)
  171. end
  172. end
  173.  
  174.  
  175. function digup() --this is to protect against gravel and sand above
  176. while turtle.digUp()
  177. do
  178. turtle.digUp()
  179. sleep(.3)
  180. end
  181. end
  182.  
  183.  
  184. function checkbackL() --this will check inventory and if it is full will go back
  185. if
  186. turtle.getItemCount(1)>0
  187. and
  188. turtle.getItemCount(2)>0
  189. and
  190. turtle.getItemCount(3)>0
  191. and
  192. turtle.getItemCount(4)>0
  193. and
  194. turtle.getItemCount(5)>0
  195. and
  196. turtle.getItemCount(6)>0
  197. and
  198. turtle.getItemCount(7)>0
  199. and
  200. turtle.getItemCount(8)>0
  201. and
  202. turtle.getItemCount(9)>0
  203. and
  204. turtle.getItemCount(10)>0
  205. and
  206. turtle.getItemCount(11)>0
  207. and
  208. turtle.getItemCount(12)>0
  209. and
  210. turtle.getItemCount(13)>0
  211. and
  212. turtle.getItemCount(14)>0
  213. and
  214. turtle.getItemCount(15)>0
  215. and
  216. turtle.getItemCount(16)>0
  217. then backL()
  218. end
  219. end
  220.  
  221.  
  222. function checkbackR()
  223. if
  224. turtle.getItemCount(1)>0
  225. and
  226. turtle.getItemCount(2)>0
  227. and
  228. turtle.getItemCount(3)>0
  229. and
  230. turtle.getItemCount(4)>0
  231. and
  232. turtle.getItemCount(5)>0
  233. and
  234. turtle.getItemCount(6)>0
  235. and
  236. turtle.getItemCount(7)>0
  237. and
  238. turtle.getItemCount(8)>0
  239. and
  240. turtle.getItemCount(9)>0
  241. and
  242. turtle.getItemCount(10)>0
  243. and
  244. turtle.getItemCount(11)>0
  245. and
  246. turtle.getItemCount(12)>0
  247. and
  248. turtle.getItemCount(13)>0
  249. and
  250. turtle.getItemCount(14)>0
  251. and
  252. turtle.getItemCount(15)>0
  253. and
  254. turtle.getItemCount(16)>0
  255. then backR()
  256. end
  257. end
  258.  
  259.  
  260. function checkback()
  261. if
  262. turtle.getItemCount(1)>0
  263. and
  264. turtle.getItemCount(2)>0
  265. and
  266. turtle.getItemCount(3)>0
  267. and
  268. turtle.getItemCount(4)>0
  269. and
  270. turtle.getItemCount(5)>0
  271. and
  272. turtle.getItemCount(6)>0
  273. and
  274. turtle.getItemCount(7)>0
  275. and
  276. turtle.getItemCount(8)>0
  277. and
  278. turtle.getItemCount(9)>0
  279. and
  280. turtle.getItemCount(10)>0
  281. and
  282. turtle.getItemCount(11)>0
  283. and
  284. turtle.getItemCount(12)>0
  285. and
  286. turtle.getItemCount(13)>0
  287. and
  288. turtle.getItemCount(14)>0
  289. and
  290. turtle.getItemCount(15)>0
  291. and
  292. turtle.getItemCount(16)>0
  293. then back()
  294. end
  295. end
  296.  
  297.  
  298. --main body use check() to set n to true or false then use "" to make sure progam knows what it is
  299. print("How long of a tunnel do you want? (must be a multiple of 2)")
  300. y=1
  301. x=read()
  302. for i=1, x/2
  303. do
  304. z=1
  305. dig()
  306. checkback()
  307. sleep(0.1)
  308. turtle.forward()
  309. y=y+1
  310. sleep(.1)
  311. turtle.turnRight()
  312. sleep(.1)
  313. dig()
  314. checkbackR()
  315. sleep(.1)
  316. turtle.turnLeft()
  317. turtle.turnLeft()
  318. sleep(.1)
  319. dig()
  320. checkbackL()
  321. sleep(.1)
  322. digup()
  323. checkbackL()
  324. sleep(.1)
  325. turtle.up()
  326. z=2
  327. sleep(.1)
  328. dig()
  329. checkbackL()
  330. sleep(.1)
  331. turtle.turnRight()
  332. turtle.turnRight()
  333. sleep(.1)
  334. dig()
  335. checkbackR()
  336. sleep(.1)
  337. digup()
  338. checkbackR()
  339. sleep(.1)
  340. turtle.up()
  341. z=3
  342. sleep(.1)
  343. dig()
  344. checkbackR()
  345. sleep(.1)
  346. turtle.turnLeft()
  347. turtle.turnLeft()
  348. sleep(.1)
  349. dig()
  350. checkbackL()
  351. sleep(.1)
  352. turtle.turnRight()
  353. sleep(.1)
  354. dig()
  355. checkback()
  356. sleep(.1)
  357. turtle.forward()
  358. y=y+1
  359. sleep(.1)
  360. turtle.turnRight()
  361. sleep(.1)
  362. dig()
  363. checkbackR()
  364. turtle.turnLeft()
  365. turtle.turnLeft()
  366. sleep(.1)
  367. dig()
  368. checkbackL()
  369. sleep(.1)
  370. turtle.digDown()
  371. checkbackL()
  372. sleep(.1)
  373. turtle.down()
  374. z=2
  375. sleep(.1)
  376. dig()
  377. checkbackL()
  378. sleep(.1)
  379. turtle.turnRight()
  380. turtle.turnRight()
  381. sleep(.1)
  382. dig()
  383. checkbackR()
  384. sleep(.1)
  385. turtle.digDown()
  386. checkbackR()
  387. sleep(.1)
  388. turtle.down()
  389. z=1
  390. sleep(.1)
  391. dig()
  392. checkbackR()
  393. sleep(.1)
  394. turtle.turnLeft()
  395. turtle.turnLeft()
  396. sleep(.1)
  397. dig()
  398. checkbackL()
  399. sleep(.1)
  400. turtle.turnRight()
  401. end
  402.  
  403. turtle.turnRight()
  404. turtle.turnRight()
  405. for i=1 , y
  406. do
  407. if turtle.forward()
  408. then turtle.forward()
  409. else
  410. turtle.attack()
  411. sleep(.2)
  412. turtle.forward()
  413. end
  414. end
  415. drop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement