Sayomie550

Untitled

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