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