Lefra

Turtle ramasse miettes

Jul 8th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. local longueurs = 0
  2.  
  3. function compareDig()
  4.   turtle.turnLeft()
  5.   turtle.select(1)
  6.   if not turtle.compare() then
  7.     turtle.select(2)
  8.     if not turtle.compare() then
  9.       turtle.select(3)
  10.       if not turtle.compare() then
  11.         turtle.select(4)
  12.         if not turtle.compare() then
  13.           turtle.select(5)
  14.           if not turtle.compare() then
  15.             turtle.select(6)
  16.             if not turtle.compare() then
  17.               turtle.select(7)
  18.               if not turtle.compare() then
  19.                 turtle.select(8)
  20.                 if not turtle.compare() then
  21.                   turtle.dig()
  22.                 end
  23.               end
  24.             end
  25.           end
  26.         end
  27.       end
  28.     end
  29.   end
  30.   turtle.turnRight()
  31. end
  32.  
  33. while true do
  34.   while not turtle.detect() do
  35.     compareDig()
  36.     turtle.forward()
  37.   end
  38.   turtle.turnRight()
  39.   longueurs = longueurs + 1
  40.   if longueurs == 4 then
  41.     longueurs = 0
  42.     turtle.down()
  43.   end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment