Advertisement
McKillopBK

PumpkinFinal

Dec 20th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.67 KB | None | 0 0
  1. length = 100
  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.         --sleep(x)
  33.     --end
  34.    
  35.     --If turtle does detect block in FRONT, start harvest cycle
  36.     --if turtle.detect() then
  37.         --print("***Detected! ".."Now ".."Harvesting!")
  38.         print("Fuel :"..turtle.getFuelLevel())
  39.         --Forward 6 blocks
  40.         i = 0
  41.             repeat
  42.             forward()
  43.             i = i + 1
  44.         until i == 6
  45.         --CornerLeft
  46.         cornerLeft()
  47.         --Forward 10
  48.         i = 0
  49.             repeat
  50.             forward()
  51.             i = i + 1
  52.         until i == 10
  53.         --Small Corner Right
  54.         turtle.turnRight()
  55.         forward()
  56.         turtle.turnRight()
  57.         --Turn Corner, Forward 10
  58.         i = 0
  59.             repeat
  60.             forward()
  61.             i = i + 1
  62.         until i == 10
  63.         turtle.turnRight()
  64.         i = 0
  65.             repeat
  66.             forward()
  67.             i = i + 1
  68.         until i == 8
  69.         turtle.turnRight()
  70.         i = 0
  71.             repeat
  72.             forward()
  73.             i = i + 1
  74.         until i == 12
  75.         --Corner Right
  76.         cornerRight()
  77.         i = 0
  78.             repeat
  79.             forward()
  80.             i = i + 1
  81.         until i == 10
  82.         turtle.turnLeft()
  83.         forward()
  84.         turtle.turnLeft()
  85.         i = 0
  86.             repeat
  87.             forward()
  88.             i = i + 1
  89.         until i == 8
  90.         turtle.turnRight()
  91.         turtle.turnRight()
  92.         forward()
  93.         forward()
  94.         forward()
  95.         forward()
  96.         print("Harvested!")
  97.         print("Fuel :"..turtle.getFuelLevel())
  98.         --End of harvest cycle
  99.         print("Sleeping ".."For ".."600 ".."Seconds")
  100.         sleep(50)
  101.         print("Sleeping ".."For ".."550 ".."Seconds")
  102.         sleep(50)
  103.         print("Sleeping ".."For ".."500 ".."Seconds")
  104.         sleep(50)
  105.         print("Sleeping ".."For ".."450 ".."Seconds")
  106.         sleep(50)
  107.         print("Sleeping ".."For ".."400 ".."Seconds")
  108.         sleep(50)
  109.         print("Sleeping ".."For ".."350 ".."Seconds")
  110.         sleep(50)
  111.         print("Sleeping ".."For ".."300 ".."Seconds")
  112.         sleep(50)
  113.         print("Sleeping ".."For ".."250 ".."Seconds")
  114.         sleep(50)
  115.         print("Sleeping ".."For ".."200 ".."Seconds")
  116.         sleep(50)
  117.         print("Sleeping ".."For ".."150 ".."Seconds")
  118.         sleep(50)
  119.         print("Sleeping ".."For ".."100 ".."Seconds")
  120.         sleep(50)
  121.         print("Sleeping ".."For ".."50 ".."Seconds")
  122.         sleep(50)
  123.         print("Slept ".."For ".."600 ".."Seconds")
  124.         print("Fuel :"..turtle.getFuelLevel())
  125.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement