Sayomie550

Untitled

Jul 18th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.86 KB | None | 0 0
  1. local on = 1
  2. local count = 0
  3. local trees = 0
  4. local dropoff = 0
  5. local place = 0
  6.  
  7. io.write( "Run initial setup?: " )
  8. settings = io.read()
  9.  
  10. if settings == "yes" then
  11.     sleep(1)
  12.     print( "Logging Program Setup Initiated" )
  13.     sleep(1)
  14.     print( "Input Number of trees to tend" )
  15.     print( "1-64" )
  16.     io.write("# trees: ")
  17.     trees = io.read()
  18.    
  19.     while trees < 1 and trees > 65 do
  20.         print( "Enter an ammount from 1-64" )
  21.         io.write("trees: ")
  22.         trees = io.read()
  23.     end
  24.    
  25.     print( "place "..trees" Saplings into slot 1 of the turtle" )
  26.     sleep(1)
  27.     print( "place "..trees" Redstone Torchs into slot 2 of the turtle" )
  28.     sleep(1)
  29.     print( "place 2 Dirt Blocks into slot 3 of the turtle" )
  30.     sleep(1)
  31.     print( "place "..trees" Torchs into slot 4 of the turtle" )
  32.     sleep(1)
  33.     io.write("finished?: ")
  34.     place = io.read()
  35.    
  36.     while place ~= "yes" do
  37.         sleep(1)
  38.         print( "Type in yes when finished" )
  39.         io.write("Finished: ")
  40.         place = io.read()
  41.     end
  42.    
  43.     print( "Starting Initial Setup" )
  44.     turtle.up()
  45.     turtle.select(2)
  46.    
  47.     place = 1
  48.     print( "Placing Redstone Torch "..place"of "..trees )
  49.     turtle.placeDown()
  50.    
  51.     while place < trees do
  52.         turtle.forward()
  53.         turtle.forward()
  54.         turtle.forward()
  55.         place = place + 1
  56.         print( "Placing Redstone Torch "..place"of "..trees )
  57.         turtle.placeDown()
  58.     end
  59.    
  60.     turtle.turnLeft()
  61.     turtle.forward()
  62.     turtle.forward()
  63.     turtle.turnLeft()
  64.     turtle.forward()
  65.    
  66.     turtle.select(4)
  67.    
  68.     place = 1
  69.     print ( "Placing Torch "..place"of "..trees )
  70.     turtle.placeDown()
  71.    
  72.     while place < trees - 1 do
  73.         turtle.forward()
  74.         turtle.forward()
  75.         turtle.forward()
  76.         place = place + 1
  77.         print( "Placing Torch "..place"of "..trees )
  78.         turtle.placeDown()
  79.     end
  80.    
  81.     turtle.turnRight()
  82.     turtle.forward()
  83.     turtle.turnRight()
  84.     turtle.select(3)
  85.     print( "Placing Blocker 1 of 2" )
  86.     turtle.place()
  87.    
  88.     turtle.forward()
  89.     turtle.down()
  90.     print( "Digging Detector Hole")
  91.     turtle.digDown()
  92.     turtle.up()
  93.    
  94.     turtle.turnRight()
  95.     turtle.forward()
  96.     turtle.turnLeft()
  97.    
  98.     turtle.select(1)
  99.    
  100.     place = 1
  101.     print( "Placing Sapling "..place"of "..trees )
  102.     turtle.placeDown()
  103.    
  104.     while place < trees - 1 do
  105.         turtle.forward()
  106.         turtle.forward()
  107.         turtle.forward()
  108.         place = place + 1
  109.         print( "Placing Sapling "..place"of "..trees )
  110.         turtle.placeDown()
  111.     end
  112.    
  113.     turtle.forward()
  114.     turtle.turnLeft()
  115.     turtle.forward()
  116.     turtle.turnLeft()
  117.    
  118.     print( "Placing Blocker 2 of 2" )
  119.     turtle.select(3)
  120.     turtle.place()
  121.    
  122.     print( "Initial Setup Complete" )
  123.     sleep(1)
  124.     print( "Please Place the Repeaters now" )
  125.     sleep(1)
  126.     print( "Redstone Torch -> Repeater -> Tree" )
  127.     sleep(1)
  128.     print( "When Complete type in 1" )
  129.     place = 0
  130.     place = io.read("*number")
  131.    
  132.     while place ~= 1 do
  133.         print( "Type in 1 when Complete" )
  134.         place = io.read("*number")
  135.     end
  136.    
  137.     turtle.forward()
  138.     turtle.down()
  139. end
  140.  
  141. print( "Auto Drop Stacks of Lumber?" )
  142. io.write("yes or no?: ")
  143. dropoff = io.read()
  144.  
  145. while on == 1 do
  146.  
  147.     while not turtle.detect() do
  148.         turtle.forward()
  149.        
  150.         while redstone.getInput("left", true) do
  151.             tree = tree + 1
  152.            
  153.             print( "Tree Detected Starting Logging Sequence" )
  154.             print( "This is tree number: "..tree )
  155.            
  156.             turtle.turnLeft()
  157.             turtle.forward()
  158.             turtle.dig()
  159.             turtle.forward()
  160.  
  161.             while turtle.detectUp() do
  162.                 turtle.digUp()
  163.                 turtle.up()
  164.             end
  165.            
  166.             while not turtle.detectUp() and not turtle.detectDown() do
  167.                 turtle.down()
  168.             end
  169.            
  170.             turtle.back()
  171.             print( "Logging Sequence Complete" )
  172.            
  173.             print( "Replanting Sapling" )
  174.             turtle.select(1)
  175.             turtle.place(1)
  176.            
  177.             turtle.back()
  178.             turtle.turnRight()
  179.         end
  180.        
  181.         while redstone.getInput("right", true) do
  182.             tree = tree + 1
  183.            
  184.             print( "Tree Detected Starting Logging Sequence" )
  185.             print( "This is tree number: "..tree )
  186.            
  187.             turtle.turnRight()
  188.             turtle.forward()
  189.             turtle.dig()
  190.             turtle.forward()
  191.  
  192.             while turtle.detectUp() do
  193.                 turtle.digUp()
  194.                 turtle.up()
  195.             end
  196.            
  197.             while not turtle.detectUp() and not turtle.detectDown() do
  198.                 turtle.down()
  199.             end
  200.            
  201.             turtle.back()
  202.             print( "Logging Sequence Complete" )
  203.            
  204.             print( "Replanting Sapling" )
  205.             turtle.select(1)
  206.             turtle.place(1)
  207.            
  208.             turtle.back()
  209.             turtle.turnLeft()
  210.         end
  211.     end
  212.    
  213.     while turtle.detect() and not turtle.detectDown() and dropoff == "yes" do
  214.        
  215.         if turtle.getItemSpace(2) == 0 then
  216.        
  217.             while turtle.detectUp() do
  218.                 turtle.digUp()
  219.             end
  220.             turtle.up()
  221.            
  222.             while turtle.detect() do
  223.                 turtle.dig()
  224.             end
  225.             turtle.forward()
  226.            
  227.             while turtle.detect() do
  228.                 turtle.dig()
  229.             end
  230.             turtle.forward()
  231.        
  232.             turtle.select(2)
  233.             turtle.drop()
  234.            
  235.             if turtle.getItemSpace(3) < 64 then
  236.                 turtle.select(3)
  237.                 turtle.drop()
  238.             end
  239.            
  240.             turtle.back()
  241.             turtle.back()
  242.             turtle.down()
  243.         end
  244.        
  245.         turtle.turnRight()
  246.         turtle.turnRight()
  247.     end
  248.    
  249.     while turtle.detect() do
  250.         turtle.turnRight()
  251.         turtle.turnRight()
  252.     end
  253. end
Advertisement
Add Comment
Please, Sign In to add comment