Advertisement
McKillopBK

PumpkinFarmNoDetect

Dec 19th, 2015
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.49 KB | None | 0 0
  1. length = 10
  2. --Setting loop length
  3. --Each time turtle does not detect, or detects, counts as 1 cycle of loop
  4. for i=1, length, 1 do
  5.    
  6.     --Function hits block in front, then moves forward
  7.     function forward()
  8.         turtle.dig()
  9.         turtle.forward()
  10.     end
  11.    
  12.     --Function turns right, Forward 3, Turns right
  13.     function cornerRight()
  14.         turtle.turnRight()
  15.         forward()
  16.         forward()
  17.         forward()
  18.         turtle.turnRight()
  19.     end
  20.    
  21.     --Function turns left, Forward 3, Turns left
  22.     function cornerLeft()
  23.         turtle.turnLeft()
  24.         forward()
  25.         forward()
  26.         forward()
  27.         turtle.turnLeft()
  28.     end
  29.        
  30.     -- **not used currently** If turtle doesn't detect block in FRONT, Sleep for 300 Seconds
  31.     --if not turtle.detect() then
  32.         --print("Not ".."Detected, ".."Sleeping ".."For ".."300 ".."Seconds")
  33.         --sleep(50)
  34.         --print("Sleeping ".."For ".."250 ".."Seconds")
  35.         --sleep(50)
  36.         --print("Sleeping ".."For ".."200 ".."Seconds")
  37.         --sleep(50)
  38.         --print("Sleeping ".."For ".."150 ".."Seconds")
  39.         --sleep(50)
  40.         --print("Sleeping ".."For ".."100 ".."Seconds")
  41.         --sleep(50)
  42.         --print("Sleeping ".."For ".."50 ".."Seconds")
  43.         --sleep(50)
  44.         --print("Slept ".."For ".."300 ".."Seconds")
  45.         --print("Fuel :"..turtle.getFuelLevel())
  46.     --end
  47.    
  48.     --If turtle does detect block in FRONT, start harvest cycle
  49.     --if turtle.detect() then
  50.         --print("***Detected! ".."Now ".."Harvesting!")
  51.         print("Fuel :"..turtle.getFuelLevel())
  52.         --Forward 6 blocks
  53.         forward()
  54.         forward()
  55.         forward()
  56.         forward()
  57.         forward()
  58.         forward()
  59.         --CornerLeft
  60.         cornerLeft()
  61.         --Forward 10
  62.         forward()
  63.         forward()
  64.         forward()
  65.         forward()
  66.         forward()
  67.         forward()
  68.         forward()
  69.         forward()
  70.         forward()
  71.         forward()
  72.         --Small Corner Right
  73.         turtle.turnRight()
  74.         forward()
  75.         turtle.turnRight()
  76.         --Turn Corner, Forward 10
  77.         forward()
  78.         forward()
  79.         forward()
  80.         forward()
  81.         forward()
  82.         forward()
  83.         forward()
  84.         forward()
  85.         forward()
  86.         forward()
  87.         turtle.turnRight()
  88.         forward()
  89.         forward()
  90.         forward()
  91.         forward()
  92.         forward()
  93.         forward()
  94.         forward()
  95.         forward()
  96.         turtle.turnRight()
  97.         forward()
  98.         forward()
  99.         forward()
  100.         forward()
  101.         forward()
  102.         forward()
  103.         forward()
  104.         forward()
  105.         forward()
  106.         forward()
  107.         forward()
  108.         forward()
  109.         --Corner Right
  110.         cornerRight()
  111.         forward()
  112.         forward()
  113.         forward()
  114.         forward()
  115.         forward()
  116.         forward()
  117.         forward()
  118.         forward()
  119.         forward()
  120.         forward()
  121.         turtle.turnLeft()
  122.         forward()
  123.         turtle.turnLeft()
  124.         forward()
  125.         forward()
  126.         forward()
  127.         forward()
  128.         forward()
  129.         forward()
  130.         forward()
  131.         forward()
  132.         turtle.turnRight()
  133.         turtle.turnRight()
  134.         forward()
  135.         forward()
  136.         forward()
  137.         forward()
  138.         print("Harvested!")
  139.         print("Fuel :"..turtle.getFuelLevel())
  140.         print("Sleeping ".."For ".."600 ".."Seconds")
  141.         sleep(50)
  142.         print("Sleeping ".."For ".."550 ".."Seconds")
  143.         sleep(50)
  144.         print("Sleeping ".."For ".."500 ".."Seconds")
  145.         sleep(50)
  146.         print("Sleeping ".."For ".."450 ".."Seconds")
  147.         sleep(50)
  148.         print("Sleeping ".."For ".."400 ".."Seconds")
  149.         sleep(50)
  150.         print("Sleeping ".."For ".."350 ".."Seconds")
  151.         sleep(50)
  152.         print("Sleeping ".."For ".."300 ".."Seconds")
  153.         sleep(50)
  154.         print("Sleeping ".."For ".."250 ".."Seconds")
  155.         sleep(50)
  156.         print("Sleeping ".."For ".."200 ".."Seconds")
  157.         sleep(50)
  158.         print("Sleeping ".."For ".."150 ".."Seconds")
  159.         sleep(50)
  160.         print("Sleeping ".."For ".."100 ".."Seconds")
  161.         sleep(50)
  162.         print("Sleeping ".."For ".."50 ".."Seconds")
  163.         sleep(50)
  164.         print("Slept ".."For ".."600 ".."Seconds")
  165.         print("Fuel :"..turtle.getFuelLevel())
  166.         --End of harvest cycle
  167.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement