View difference between Paste ID: Ph4ReE16 and nWjtcZjK
SHOW: | | - or go back to the newest paste.
1
j=0
2
i=0
3
4-
write("Turtlenummer: ")
4+
turtle=1
5-
turtle = tonumber(read())
5+
6
max=tonumber(read())
7
8
rednet.open("right")
9
10
function sendPos()
11
  local x,y,z = gps.locate(5)
12
  rednet.broadcast("[" .. turtle .. "]: (" .. x .. "," .. y .. "," .. z .. ")")
13
end
14
15
function fforward()
16
  while(turtle.forward()==false) do
17
    turtle.dig()
18
  end
19
end
20
21
function fdigUp()
22
  while(turtle.detectUp()) do
23
    turtle.digUp()
24
    sleep(0.4)
25
  end
26
end
27
28
function placeTorch()
29
  turtle.turnRight()
30
  turtle.turnRight()
31
  turtle.select(2)
32
  turtle.place()
33
  turtle.turnRight()
34
  turtle.turnRight()
35
  j=0
36
end
37
38
function step()
39
  fforward()
40
  fdigUp()
41
  turtle.select(1)
42
  turtle.placeDown()
43
  if(j>12) then
44
    placeTorch()
45
  end
46
  j=j+1
47
end
48
49
while(i<max) do
50
  for k=1,i do
51
    step()
52
  end
53
  turtle.turnRight()
54
  i=i+2
55
  sendPos()
56
end
57
58
rednet.close("right")