TheGreekMan02

More fence layin

Jun 16th, 2014
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local selection = 1
  2. local z = 1
  3. turtle.select(1)
  4.  
  5. local function restock()
  6.         turtle.select(16)
  7.         turtle.place()
  8.  
  9.         for i=1,15 do
  10.                 turtle.select(i)
  11.                 turtle.suck()
  12.  
  13.         turtle.select(16)
  14.         turtle.dig()
  15.         turtle.select(1)
  16. end
  17.  
  18. local function placeFence()
  19.         turtle.digDown()
  20.         turtle.placeDown()
  21.     while not turtle.forward() do
  22.                 turtle.dig()
  23.         end
  24.     while turtle.getItemCount(selection) == 0 do
  25.                 selection = selection + 1
  26.                 turtle.select(selection)
  27.         end
  28.  
  29.  
  30.     if selection == 16 then
  31.         restock()
  32.         selection = 1
  33.     end
  34.     turtle.select(selection)
  35. end
  36.  
  37. local function howBig()
  38.     term.clear()
  39.     term.setCursorPos(1,1)
  40.     print("How long do you want the quarry?")
  41.     x = tonumber(read())
  42.     print("How wide do you want the quarry?")
  43.     y = tonumber(read())
  44.     print("Laying fence "..x.." by "..y)
  45. end
  46.  
  47. local function layinFence()
  48.     for i=1,x-1 do
  49.         placeFence()
  50.     end
  51.     turtle.turnLeft()
  52.     for i=1,y-1 do
  53.         placeFence()
  54.     end
  55.     turtle.turnLeft()
  56.     for i=1, x-1 do
  57.         placeFence()
  58.     end
  59.     turtle.turnLeft()
  60.     for i=1, y-1 do
  61.         placeFence()
  62.     end
  63.     turtle.turnLeft()
  64. end
  65.  
  66. howBig()
  67. layinFence()
Advertisement
Add Comment
Please, Sign In to add comment