Sayomie550

Untitled

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