jonassvensson4

Untitled

Jun 8th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. -- #########################
  2. -- # Torches, Chest, Empty #
  3. -- #########################
  4. invT = 8
  5. invC = 7
  6. invE = 9
  7.  
  8. print("Starting branch-program")
  9. print("Please place your turtle like this:")
  10. print(" # # # ")
  11. print(" # # # ")
  12. print(" # T # ")
  13. end
  14.  
  15. local message = io.read()
  16.  
  17. if ( message == "branchmine" ) then
  18.     print("How many rows?")
  19.     message = io.read()
  20.  
  21.     rows = tonumber( message )
  22. end
  23.  
  24.     if ( rows  ~= 0 ) then
  25.         for i=1, rows do
  26.  
  27.                 turtle.dig()
  28.                 turtle.forward()
  29.                 turtle.digUp()
  30.         end
  31.  
  32. -- ##################
  33. -- # Full inventory #
  34. -- ##################
  35.         turtle.select(invE)
  36.                 if turtle.getItemCount > 0 then
  37.                         turtle.select(invC)
  38.                                 turtle.place()
  39.                                         turtle.select(1)
  40.                                         turtle.drop()
  41.                                         turtle.select(2)
  42.                                         turtle.drop()
  43.                                         turtle.select(3)
  44.                                         turtle.drop()
  45.                                         turtle.select(4)
  46.                                         turtle.drop()
  47.                                         turtle.select(5)
  48.                                         turtle.drop()
  49.                                         turtle.select(6)
  50.                                         turtle.drop()
  51.                         turtle.select(invC)
  52.                                 turtle.dig()
  53.                         end
  54.         else
  55.             turtle.select(invT)
  56.         end
  57. -- ###########################
  58. -- # Return, placing torches #
  59. -- ###########################
  60.         turtle.select(invT)
  61.  
  62.                 for i=1, rows do
  63.                         turtle.back()
  64.  
  65.                         if i % 6 == 0 then
  66.                                 turtle.place()
  67.                 end
  68.  
  69. -- ######################
  70. -- # Starting a new row #
  71. -- ######################
  72.         turtle.turnLeft()
  73.                     turtle.forward()
  74.             turtle.digUp()
  75.             turtle.digDown()
  76.                             turtle.forward()
  77.                 turtle.digUp()
  78.                 turtle.digDown()
  79.                                 turtle.forward()
  80.                     turtle.digUp()
  81.                     turtle.digDown()
  82.                                     turtle.turnRight()
  83.                         end
  84. end
Advertisement
Add Comment
Please, Sign In to add comment