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