Sayomie550

Untitled

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