BruceWplays

Lauren Farm 3

Jun 29th, 2022 (edited)
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.27 KB | None | 0 0
  1. version = "5"
  2.   term.clear()
  3.   term.setCursorPos(1, 1)
  4. --print(version)
  5. sleep(3)
  6. done = 0
  7. for l=1,10 do
  8. if fs.exists("goto") == false
  9. then do
  10. print("downloading goto")
  11. shell.run("pastebin","get","Rj9UiYUJ","goto")
  12.      if fs.exists("goto") == true then
  13.             print("download complete")
  14.                 elseif fs.exists("goto") == false then
  15.                 print("download failed")
  16.                 end
  17. end
  18. else do
  19.            
  20.   term.clear()
  21.   term.setCursorPos(1, 1)                          
  22.  print("recentering")          
  23. while true do
  24. if done ~= 4 then do
  25. --CHANGE HERE START
  26. lenth = 5
  27. st_width = 5
  28. --CHANGE HERE END
  29.  
  30.  
  31.                        
  32.    
  33.                        
  34.                        
  35.                        
  36. totalsteps = 2
  37.                        
  38.                        
  39.                        
  40. endsteps = totalsteps + 1                    
  41. sub_lenth = lenth - 1                      
  42. function chest()                        
  43.  term.clear()
  44.         term.setCursorPos(1, 1)                                
  45.        print("going to chest")                        
  46. shell.run("goto", "359", "88", "629")
  47.                          
  48.                                
  49.     chest = 2
  50.         term.clear()
  51.         term.setCursorPos(1, 1)                          
  52.     print("putting in chest")
  53.     while chest ~= 17 do
  54.     turtle.select(chest)
  55.     turtle.dropDown()
  56.     chest = chest + 1
  57.   end  
  58.    sleep(20)
  59.    os.reboot()                        
  60.  end                              
  61.                                
  62.                                
  63.                                
  64. function turn()
  65.                                    
  66. if right == 1 then
  67.                                    --print("right")
  68. turtle.turnRight()
  69. turtle.forward()
  70. turtle.turnRight()
  71.  
  72. dist = sub_lenth
  73. width = width - 1
  74. right = 0
  75. else
  76.                                     --print("left")
  77. turtle.turnLeft()
  78. turtle.forward()
  79. turtle.turnLeft()
  80. dist = sub_lenth
  81. width = width - 1
  82. right = 1
  83. end
  84. end
  85.  
  86.                        
  87. function recenter()
  88.                            
  89.                            
  90. shell.run("goto", "363", "89", "631")
  91.  
  92. shell.run("goto", "359", "89", "629")
  93. turtle.turnRight()
  94. right = 1
  95. turtle.select(1)
  96. dist = lenth - 1
  97. turtle.forward()                
  98. turtle.forward()                            
  99. end
  100.                        
  101.                        
  102.  
  103. if width == 0 or width == nil  then
  104.  done = done + 1
  105.       --print ("add")                      
  106.     --print ("Steps: " .. done)
  107.   if done == 3 then
  108.                                recenter()
  109.                                 chest()
  110.                                   done = 0
  111.                                     end
  112.  
  113. width = st_width
  114.                             --print("width: " .. width)
  115.                             recenter()
  116.  elseif width ~= 0 then
  117.                                
  118.                            
  119.                            
  120. if dist ~= 0 then                          
  121.            
  122.                          
  123. if done == 1 then
  124. term.clear()
  125.    while width ~= 0 do                                
  126.     while dist ~= 0 do
  127.                                            
  128.                  ---REPLACE LATER!!!!!!                          
  129.                                        term.setCursorPos(1, 1)
  130.                    term.clearLine()                        
  131.                  print ("Stage: " .. done .. "/" .. totalsteps.. " Harvest and Plant")                            
  132.        success, data = turtle.inspectDown()  
  133.          if success then                                    
  134.                                             term.setCursorPos(1, 2)
  135.                                                 term.clearLine()
  136.                                                 percentagefloat = (data.state.age - 0) / (7 - 0) * 100
  137.                                                 percentage = math.floor(percentagefloat+0.5)
  138.                                                
  139.                                                 print("Crop Age: " .. percentage .. "%")
  140.                                            
  141.      if data.state.age == 7 then
  142.            --print("Age Check 2: " .. data.state.age)                                          
  143.         turtle.digDown()
  144.                  turtle.suckDown()                                  
  145.                  --term.setCursorPos(1, 3)
  146.                   --term.clearLine()                                  
  147.                  --print("dig")                              
  148.               end
  149.                 end
  150.                   turtle.placeDown()                        
  151.                  ---REPLACE LATER END!!!!!!                          
  152.                                            
  153.                                            
  154.                    turtle.forward()                        
  155.                    term.setCursorPos(1, 1)
  156.                    term.clearLine()                        
  157.                  print ("Stage: " .. done .. "/" .. totalsteps.. " Harvest and Plant")                            
  158.        success, data = turtle.inspectDown()  
  159.          if success then                                    
  160.                                             term.setCursorPos(1, 2)
  161.                                                 term.clearLine()
  162.                                                 percentagefloat = (data.state.age - 0) / (7 - 0) * 100
  163.                                                 percentage = math.floor(percentagefloat+0.5)
  164.                                                
  165.                                                 print("Crop Age: " .. percentage .. "%")
  166.                                            
  167.      if data.state.age == 7 then
  168.            --print("Age Check 2: " .. data.state.age)                                          
  169.         turtle.digDown()
  170.                  turtle.suckDown()                                  
  171.                  --term.setCursorPos(1, 3)
  172.                   --term.clearLine()                                  
  173.                  --print("dig")                              
  174.               end
  175.                 end
  176.                   turtle.placeDown()                    
  177.                  
  178.                                            
  179.          
  180.                                                
  181. --print("dig")
  182.        dist = dist - 1
  183.                                                    
  184.              
  185.          end                              
  186.    turn()
  187.    
  188.        end                            
  189.  
  190. elseif done == 2 then
  191.      term.clear()                                
  192.    while width ~= 0 do                                  
  193.     while dist ~= 0 do
  194.                      ---REPLACE LATER!!!!!!  
  195.                                          term.setCursorPos(1, 1)  
  196.                                         term.clearLine()
  197.                                             print ("Stage: " .. done .. "/" .. totalsteps .. " Cleanup")                                    
  198.         turtle.suckDown()
  199.                    ---REPLACE LATER END!!!!!!                          
  200.         turtle.forward()
  201.         term.setCursorPos(1, 1)
  202.                                  term.clearLine()
  203.                                             print ("Stage: " .. done .. "/" .. totalsteps .. " Cleanup")                                    
  204.         turtle.suckDown()
  205.        
  206.                                     --print("grab")
  207.                                                
  208.        dist = dist - 1
  209.        end
  210.        turn()                                
  211.     end
  212.                                        
  213. --unused planting phase not needed because in can be done after digging
  214. elseif done == 4 then
  215.    
  216.    while width ~= 0 do                                
  217.     while dist ~= 0 do
  218.         turtle.placeDown()
  219.         turtle.forward()
  220.        print("plant")
  221.             print ("Steps: " .. done)                                  
  222.    dist = dist - 1
  223.        end
  224.        turn()                                      
  225.     end
  226.       --end- unused planting phase end                        
  227.  
  228.  end
  229.  
  230.                                     end
  231.  
  232.  
  233.                                
  234.  
  235.  
  236.  
  237.  
  238. end
  239. end
  240. end
  241. end                    
  242. end                    
  243.     end                
  244.     end                
Add Comment
Please, Sign In to add comment