• API
• FAQ
• Tools
• Archive
A Pastebin account makes a great Christmas gift
SHARE
TWEET

# Untitled

a guest Jul 21st, 2018 61 Never
ENDING IN00days00hours00mins00secs

1. write("How many levels should I dig: ")
3.
4. write("Enter fuel slot (1-9): ")
6.
7. write("Enter torches slot (1-9): ")
9.
10. write("Digging a 3x3 for "..levels.." levels!\n")
11.
12. function checkFuel()
13.   if turtle.getFuelLevel() < 5 then
14.     turtle.select(1)
15.     if not turtle.refuel(1) then
16.       error("Out of fuel")
17.     end
18.   end
19. end
20.
21. function placeTorch()
22.   turtle.select(torchSlot)
23.   turtle.turnLeft()
24.   turtle.turnLeft()
25.   turtle.place()
26.   turtle.turnRight()
27.   turtle.turnRight()
28. end
29.
30. function forward()
31.   while not turtle.forward() do
32.     turtle.dig()
33.     sleep(0.5)
34.   end
35. end
36.
37. function up()
38.   while not turtle.up() do
39.     turtle.digUp()
40.     sleep(0.5)
41.   end
42. end
43.
44. function mineLayer()
45.   turtle.dig()
46.   forward()
47.
48.   turtle.turnLeft()
49.   turtle.dig()
50.   turtle.digUp()
51.   up()
52.   turtle.dig()
53.   turtle.digUp()
54.   up()
55.   turtle.dig()
56.
57.   turtle.turnRight()
58.   turtle.turnRight()
59.   turtle.dig()
60.   turtle.down()
61.   turtle.dig()
62.   turtle.down()
63.   turtle.dig()
64.
65.   turtle.turnLeft()
66. end
67.
68. local levelsSinceTorch = 1
69.
70. for i=1,levels do
71.   checkFuel()
72.   mineLayer()
73.   if levelsSinceTorch % 6 == 0 then
74.     placeTorch()
75.   end
76.   levelsSinceTorch = levelsSinceTorch + 1
77. end
78.
79. turtle.turnLeft()
80. turtle.turnLeft()
81. for i=1,levels do
82.   if turtle.detect() then
83.     turtle.dig()
84.   end
85.   turtle.forward()
86. end
87.
88. write("Finished mining\n")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top