Advertisement
DerMarten

Boden

Sep 9th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local status = 0 -- 0 = Rechts -- 1 = Links --
  2. local slot = 1
  3. local stop = true
  4. function checkSlot()
  5.     local run = true
  6.     while run do
  7.         local items = turtle.getItemCount(slot)
  8.         if items == 0 then
  9.             if slot == 16 and items == 0 then
  10.                 stop = false
  11.             end
  12.             slot = slot + 1
  13.         else
  14.             run = false
  15.         end
  16.         os.sleep(0.001)
  17.     end
  18.    
  19. end
  20. turtle.forward()
  21. while stop do
  22.     checkSlot()
  23.     if turtle.detect() == true then
  24.         if status == 0 then
  25.             turtle.turnRight()
  26.             turtle.forward()
  27.             turtle.turnRight()
  28.             turtle.forward()
  29.             status = 1
  30.         elseif status == 1 then
  31.             turtle.turnLeft()
  32.             turtle.forward()
  33.             turtle.turnLeft()
  34.             turtle.forward()
  35.             status = 0
  36.         end
  37.     elseif turtle.detect() == false then
  38.         turtle.placeDown()
  39.         turtle.forward()
  40.     end
  41.     os.sleep(0.5)
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement