Advertisement
Ineentho

Wall builder

Sep 21st, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local function forward()
  2.   while not turtle.forward() do
  3.     print("Blocked or out of fuel")
  4.   end
  5. end
  6.  
  7. local slot = 1
  8.  
  9. turtle.select(1)
  10.  
  11. local function checkSlot()
  12.   local loopCount = 0
  13.   while turtle.getItemCount(slot) == 0 do
  14.     loopCount = loopCount + 1
  15.     slot = slot + 1
  16.     if slot > 16 then
  17.       slot = 1
  18.     end
  19.     turtle.select(slot)
  20.  
  21.     if loopCount > 15 then
  22.       print("Waiting for more building materials.")
  23.       sleep(10)
  24.     end
  25.   end
  26. end
  27.  
  28. while true do
  29.   turtle.placeUp()
  30.   checkSlot()
  31.   if turtle.detect() then
  32.     turtle.turnLeft()
  33.     turtle.turnLeft()
  34.     turtle.down()
  35.   else
  36.     forward()
  37.   end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement