Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. j=0
  2. i=0
  3.  
  4. turtle=1
  5. max=10
  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.   if x then
  14.     rednet.broadcast("[" .. turtle .. "]: (" .. x .. "," .. y .. "," .. z .. ")")
  15.   end
  16. end
  17.  
  18. function fforward()
  19.   while(turtle.forward()==false) do
  20.     turtle.dig()
  21.   end
  22. end
  23.  
  24. function fdigUp()
  25.   while(turtle.detectUp()) do
  26.     turtle.digUp()
  27.     sleep(0.4)
  28.   end
  29. end
  30.  
  31. function placeTorch()
  32.   turtle.turnRight()
  33.   turtle.turnRight()
  34.   turtle.select(2)
  35.   turtle.place()
  36.   turtle.turnRight()
  37.   turtle.turnRight()
  38.   j=0
  39. end
  40.  
  41. function step()
  42.   fforward()
  43.   fdigUp()
  44.   turtle.select(1)
  45.   turtle.placeDown()
  46.   if(j>12) then
  47.     placeTorch()
  48.   end
  49.   j=j+1
  50. end
  51.  
  52. while(i<max) do
  53.   for k=1,i do
  54.     step()
  55.   end
  56.   turtle.turnRight()
  57.   i=i+2
  58.   sendPos()
  59. end
  60.  
  61. rednet.close("right")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement