View difference between Paste ID: 5r3aQYDV and jESqe7VT
SHOW: | | - or go back to the newest paste.
1
-- Branch mine script for Turtles
2
-- Written by iPeer
3
4
-- Args:
5
-- branch length spacing number
6
7
local targs = { ... }
8
local len = tonumber(targs[1]) or 20
9
local spacing = tonumber(targs[2]) or 3
10
local num = tonumber(targs[3]) or 5
11
12
print("Doing "..num.." branches of "..len.." with "..spacing.." blocks between them.")
13
14
for branch = 1, num, 1 do
15
  print("Branch "..branch.."/"..num)
16
  for move = 1, len do
17
    while turtle.detect() do
18
      turtle.dig()
19
      sleep(0.5)
20
    end
21
    if turtle.detectUp() then
22
      turtle.digUp()
23
    end
24
    turtle.forward()
25
    if turtle.detectUp() then
26
      turtle.digUp()
27
    end
28
  end
29
  turtle.turnLeft()
30
  turtle.turnLeft()
31
  for back = 1, len do
32
    turtle.forward()
33
  end
34
  
35
  if branch > 1 then -- Returning to the chest
36
    turtle.turnRight()  
37
    for x = 2, branch do
38
      for i = 0, spacing do
39
        turtle.forward()
40
      end
41
    end
42
    turtle.turnLeft()
43
  end
44
45
  for slot = 1, 16 do
46
    turtle.select(slot)
47
    turtle.drop()
48
  end
49
50
  turtle.turnLeft()       
51
  if branch < num then  
52
    for x = 1, branch do
53
      for i = 0, spacing do
54
        while turtle.detect() do
55
          turtle.dig()
56
          if turtle.detectUp() then
57
             turtle.digUp()
58
	  end
59-
          end
59+
60
        end
61
        turtle.forward()
62
      end
63
    end    
64
  end
65
  turtle.turnLeft()
66
end
67
print("End.")