Advertisement
shirkit

cable

Apr 10th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local tArgs = {...}
  2. local length = tonumber(tArgs[1]) or 0
  3.  
  4. local slot = 1
  5.  
  6. function doWork()
  7.     for i = 1, length , 1 do
  8.        
  9.         turtle.dig()
  10.         turtle.forward()
  11.        
  12.         turtle.turnRight()
  13.         turtle.turnRight()
  14.         place("front")
  15.         turtle.turnRight()
  16.         turtle.turnRight()
  17.     end
  18. end
  19.  
  20. function place(dir)
  21.     if turtle.getItemCount(slot) == 1 then
  22.         if slot == 16 then
  23.             print("Put more blocks")
  24.             while turtle.getItemCount(slot) == 1 do
  25.                 sleep(1)
  26.             end
  27.             slot = 1
  28.         else
  29.             slot = slot + 1
  30.         end
  31.         turtle.select(slot)
  32.         place(dir)
  33.     end
  34.    
  35.     if dir == "up" then
  36.         turtle.placeUp()
  37.     elseif dir == "down" then
  38.         turtle.placeDown()
  39.     else
  40.         turtle.place()
  41.     end
  42.  
  43. end
  44. doWork()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement