# turtleQuarry

Oct 20th, 2021 (edited)
618
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. goLeft = false
2. coalSlots = {1,5,9,13}
3. iFuel = 1
4.
5. print("Enter L or R")
7. if direction == "l" then
8.     goLeft = true
9. end
10.
11. print("Enter x:")
12. x = tonumber(read()) - 1
13. xT = x
14. print("Enter y:")
15. y = tonumber(read()) - 1
16. yT = y
17. print("Enter z:")
18. z = tonumber(read()) - 1
19.
20. function refuelT ()
21.     turtle.select(coalSlots[iFuel])
22.     turtle.refuel()
23.     iFuel = iFuel + 1
24. end
25.
26. function attemptDig()
27.     turtle.dig()
28.     while turtle.detect() == true do
29.         turtle.dig()
30.         sleep(0.5)
31.     end
32. end
33.
34. refuelT()
35. while z >= 1 do
36.     x = xT
37.     while x >= 1 do
38.         y = yT
39.         --Forward on the Y axis
40.         while y >= 1 do
41.             print(y)
42.             turtle.digUp()
43.             attemptDig()
44.             turtle.forward()
45.             y = y - 1
46.         end
47.
48.         --Print local cordinates
49.         print("x: " .. x .. ",y: " .. y)
50.
51.         --Turn around statement
52.         if goLeft == true then
53.             turtle.digUp()
54.             turtle.turnLeft()
55.             attemptDig()
56.             turtle.forward()
57.             turtle.digUp()
58.             turtle.turnLeft()
59.             goLeft = false
60.         else
61.             turtle.digUp()
62.             turtle.turnRight()
63.             attemptDig()
64.             turtle.forward()
65.             turtle.digUp()
66.             turtle.turnRight()
67.             goLeft = true
68.         end
69.         x = x - 1
70.     end
71.     turtle.digDown()
72.     turtle.down()
73.     if goLeft then
74.         goLeft = false
75.     else
76.         goLeft = true
77.     end
78.     z = z - 1
79. end
RAW Paste Data