View difference between Paste ID: c8c9GQQX and vDJ9Hyf0
SHOW: | | - or go back to the newest paste.
1-
--3 wide Bridge by SparkVGX
1+
-- 3 wide Bridge v1.0 by SparkVGX
2
3
--Var
4
continue = true
5
lane = 1
6
distance = 0
7
tLeft = false
8
blocksPlaced = 0
9
Fuel = 1
10-
func pDown()
10+
11
function bForward()
12
  if turtle.detect() == true then
13
    turtle.dig()
14
    turtle.forward()
15
  end
16-
   end
16+
17
    turtle.forward()
18
  end
19
end
20-
func turn()
20+
21
function checkFuel()
22
 if turtle.getFuelLevel() <= 5 then
23
   turtle.select(1) --fuel goes in this slot
24
   turtle.refuel(1)
25
 end
26
end
27
28
function selectBlock()
29
  for sBlock=2,13 do
30
     if turtle.getItemCount(sBlock)~=0 then
31
       turtle.select(sBlock) 
32
       break
33
     end
34-
func Lane()
34+
  end 
35-
  if lane == 1
35+
36
37
--Place down
38
function pDown()
39
  selectBlock()
40
  if turtle.detectDown() == false then
41
   if turtle.placeDown() == false then
42
     print("Need blocks")
43-
  else if lane ~= 1
43+
44-
    for i=0,distance
44+
45
    end
46
    blocksPlaced = blocksPlaced + 1
47
    print(blocksPlaced)
48
  end     
49
end
50
51-
func goHome()
51+
function turn()
52
  if tLeft then
53-
  turtle.forward(2)
53+
54
    bForward()
55
    turtle.turnLeft()
56-
  for i=0,distance do
56+
57
  if tLeft == false then
58
    turtle.turnRight()
59
    bForward()
60
    turtle.turnRight()
61
  end
62
  tLeft = not tLeft
63
end
64
65
function Lane()
66
  if lane == 1 then
67
    while turtle.detect() == false do
68
      pDown()
69
      checkFuel()
70
      turtle.forward()
71
      distance = distance + 1
72
      lane = lane + 1
73
    end
74
  end
75
  if lane ~= 1 then
76
    for i=1,distance do
77
      pDown()
78
      checkFuel()
79
      bForward()
80
      pDown()
81
    end
82
  end    
83
end
84
85
function goHome()
86
  turtle.turnLeft()
87
  turtle.forward()
88
  turtle.forward()
89
  turtle.turnLeft()
90
  
91
  for i=1,distance do
92
    turtle.forward()
93
  end
94
end
95
96
97
Lane()
98
turn()
99
Lane()
100
turn()
101
Lane()    
102
goHome()