Alkerss

Turtle Test #01

Apr 29th, 2014
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. dir=0
  2. x=0
  3. y=0
  4. z=0
  5. local i=0
  6. local j=0
  7. modem = peripheral.wrap("left")
  8. function hugoDebug()
  9.   modem.transmit(3, 1337, x.." "..y)
  10.   end
  11. function hugoSurfaceMove()
  12.   hugoDebug()
  13.   if turtle.forward() then
  14.     while turtle.detectDown()~=true do
  15.       if turtle.down() then z=z-1 end
  16.       end
  17.     if dir%4==0 then x=x+1 end
  18.     if dir%4==1 then y=y+1 end
  19.     if dir%4==2 then x=x-1 end
  20.     if dir%4==3 then y=y-1 end
  21.     else
  22.     while turtle.detect() do
  23.       if turtle.up() then z=z+1 end
  24.       end
  25.     end
  26.   end
  27.  
  28.  
  29. turtle.refuel()
  30. for i=0,math.random(3,5) do
  31.   for j=0,math.random(0,3) do
  32.     turtle.turnRight()
  33.     dir=dir+1
  34.     end
  35.   for j=0,math.random(5,10) do
  36.     hugoSurfaceMove()
  37.     end
  38.   end
  39.  
  40.  
  41. turtle.up()
  42. turtle.down()
  43. if y<0 then
  44.   while dir%4~=1 do
  45.     turtle.turnRight()
  46.     dir=dir+1
  47.     end
  48.   while y<0 do hugoSurfaceMove() end
  49.   end
  50. if y>0 then
  51.   while dir%4~=3 do
  52.     turtle.turnRight()
  53.     dir=dir+1
  54.     end
  55.   while y>0 do hugoSurfaceMove() end
  56.   end
  57. if x<0 then
  58.   while dir%4~=0 do
  59.     turtle.turnRight()
  60.     dir=dir+1
  61.     end
  62.   while x<0 do hugoSurfaceMove() end
  63.   end
  64. if x>0 then
  65.   while dir%4~=2 do
  66.     turtle.turnRight()
  67.     dir=dir+1
  68.     end
  69.   while x>0 do hugoSurfaceMove() end
  70.   end
Advertisement
Add Comment
Please, Sign In to add comment