Guest User

Untitled

a guest
Dec 16th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local currentInventorySlot = 1
  2. local size = 0 + read()
  3.  
  4. function square( dimension )
  5.   if dimension == 1 then
  6.     turtle.placeDown()
  7.   else
  8.     dimension = dimension - 1
  9.     for i = 1, 4 do
  10.       for j = 1, dimension do
  11.         turtle.forward()
  12.         turtle.placeDown()
  13.       end
  14.       turtle.turnRight()
  15.     end
  16.   end
  17. end
  18.  
  19. function checkInv()
  20.   while turtle.getItemCount( currentInventorySlot ) == 0 do
  21.     currentInventorySlot = currentInventorySlot + 1
  22.     turtle.select( currentInventorySlot )
  23.     if currentInventorySlot == 16 then
  24.       turtle.select( 1 )
  25.       currentInventorySlot = 1
  26.     end
  27.   end
  28. end
  29.  
  30. turtle.select( 1 )
  31. while size > 1 do
  32.   checkInv()
  33.   square(size)
  34.   turtle.up()
  35.   turtle.forward()
  36.   turtle.turnRight()
  37.   turtle.forward()
  38.   turtle.turnLeft()
  39.   size = size - 2
  40. end
  41. checkInv()
  42. turtle.placeDown()
Add Comment
Please, Sign In to add comment