Advertisement
Vrill

Computercraft: wall 16x16x4

May 17th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. function findeSlot()
  2.  local i
  3.  for i=1,16 do
  4.   if turtle.getItemCount(i)>0 then
  5.    return i
  6.   end
  7.  end
  8.  return 0
  9. end
  10.  
  11. function moveN(n)
  12.  local i
  13.  for i=1,n do
  14.   turtle.dig()
  15.   turtle.forward()
  16.  end
  17. end
  18.  
  19. function moveNplace(n)
  20.  local i
  21.  for i=1,n do
  22.   if turtle.getItemCount(slot)==0 then
  23.    slot=findeSlot()
  24.    if slot==0 then slot=1 end
  25.    turtle.select(slot)
  26.   end
  27.   turtle.placeDown()
  28.   turtle.dig()
  29.   turtle.forward()
  30.  end
  31. end
  32. -------------------
  33. --global variables:
  34. slot=1
  35. turtle.select(slot)
  36. local i
  37. turtle.up()
  38. moveN(1)
  39. turtle.turnRight()
  40. for i=1,16 do
  41.  moveNplace(15)
  42.  turtle.turnLeft()
  43.  moveNplace(1)
  44.  turtle.turnLeft()
  45.  moveNplace(15)
  46.  turtle.turnRight()
  47.  moveNplace(1)
  48.  turtle.turnRight()
  49.  moveNplace(15)
  50.  turtle.turnLeft()
  51.  moveNplace(1)
  52.  turtle.turnLeft()
  53.  moveNplace(15)
  54.  turtle.turnLeft()
  55.  moveNplace(1)
  56.  turtle.up()
  57.  moveN(2)
  58.  turtle.turnLeft()
  59. end
  60. turtle.turnRight()
  61. moveN(1)
  62. for i=1,17 do
  63.  turtle.down()
  64. end
  65. turtle.turnRight()
  66. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement