Advertisement
Poppamunz

ComputerCraft Turtle Rectangle

May 19th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs ~= 1 then
  3.   error( "Usage: rectangle <length> <width>" )
  4.   return
  5. end
  6.  
  7. length = tArgs[1]
  8. width = tArgs[2]
  9. slot = 1
  10. turtle.select(slot)
  11.  
  12. turtle.forward()
  13.  
  14. for i=1,width do
  15.     for j=1,length do
  16.         turtle.placeDown()
  17.         turtle.forward()
  18.         if turtle.getItemCount(slot) == 0 then
  19.             slot = slot + 1
  20.             turtle.select(slot)
  21.         end
  22.     end
  23.     for k=1,length do
  24.         turtle.back()
  25.     end
  26.     turtle.turnRight()
  27.     turtle.forward()
  28.     turtle.turnLeft()
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement