Advertisement
McKillopBK

PumpkinExpansion

Dec 19th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.52 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.     --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.     --If turtle does detect block in FRONT, start harvest cycle
  48.     if turtle.detect() then
  49.         print("***Detected! ".."Now ".."Harvesting!")
  50.         print("Fuel :"..turtle.getFuelLevel())
  51.         --Forward 6 blocks
  52.         forward()
  53.         forward()
  54.         forward()
  55.         forward()
  56.         forward()
  57.         forward()
  58.         --CornerLeft
  59.         cornerLeft()
  60.         --Forward 10
  61.         forward()
  62.         forward()
  63.         forward()
  64.         forward()
  65.         forward()
  66.         forward()
  67.         forward()
  68.         forward()
  69.         forward()
  70.         forward()
  71.         --Small Corner Right
  72.         turtle.turnRight()
  73.         forward()
  74.         turtle.turnRight()
  75.         --Turn Corner, Forward 10
  76.         forward()
  77.         forward()
  78.         forward()
  79.         forward()
  80.         forward()
  81.         forward()
  82.         forward()
  83.         forward()
  84.         forward()
  85.         forward()
  86.         turtle.turnRight()
  87.         forward()
  88.         forward()
  89.         forward()
  90.         forward()
  91.         forward()
  92.         forward()
  93.         forward()
  94.         forward()
  95.         turtle.turnRight()
  96.         forward()
  97.         forward()
  98.         forward()
  99.         forward()
  100.         forward()
  101.         forward()
  102.         forward()
  103.         forward()
  104.         forward()
  105.         forward()
  106.         forward()
  107.         forward()
  108.         --Corner Right
  109.         cornerRight()
  110.         forward()
  111.         forward()
  112.         forward()
  113.         forward()
  114.         forward()
  115.         forward()
  116.         turtle.turnLeft()
  117.         forward()
  118.         turtle.turnLeft()
  119.         forward()
  120.         forward()
  121.         forward()
  122.         forward()
  123.         turtle.turnRight()
  124.         turtle.turnRight()
  125.         forward()
  126.         forward()
  127.         forward()
  128.         forward()
  129.         print("Harvested!")
  130.         print("Fuel :"..turtle.getFuelLevel())
  131.         --End of harvest cycle
  132.     end
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement