kebbanalex

Computercraft Sugar Cane Harvester Program

May 6th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. Blocks = 0
  2. Blocks1 = 0
  3.  
  4.     function Main()
  5.         MovePattern()
  6.         DropCane()
  7.         if 20 > turtle.getFuelLevel() then
  8.                 turtle.select(1)
  9.             if 1 > turtle.getItemCount(1) then
  10.                 turtle.suckUp()
  11.             end
  12.             turtle.refuel(1)
  13.         end
  14.         sleep(180)
  15.         Blocks = 0
  16.         Blocks1 = 0
  17.         Main()
  18.     end
  19.  
  20.     function DropCane()
  21.         turtle.select(2)
  22.         turtle.drop()
  23.         turtle.select(3)
  24.         turtle.drop()
  25.         turtle.select(4)
  26.         turtle.drop()
  27.         turtle.select(5)
  28.         turtle.drop()
  29.         turtle.select(6)
  30.         turtle.drop()
  31.         turtle.select(7)
  32.         turtle.drop()
  33.         turtle.select(8)
  34.         turtle.drop()
  35.         turtle.select(9)
  36.         turtle.drop()
  37.         turtle.select(10)
  38.         turtle.drop()
  39.         turtle.select(11)
  40.         turtle.drop()
  41.         turtle.select(12)
  42.         turtle.drop()
  43.         turtle.select(13)
  44.         turtle.drop()
  45.         turtle.select(14)
  46.         turtle.drop()
  47.         turtle.select(15)
  48.         turtle.drop()
  49.         turtle.select(16)
  50.         turtle.drop()
  51.     end
  52.  
  53.     function MovePattern()
  54.         turtle.turnRight()
  55.         turtle.turnRight()
  56.         TurtleForward(8)
  57.         turtle.turnRight()
  58.         turtle.turnRight()
  59.         TurtleForwardN(7)
  60.         turtle.forward()
  61.     end
  62.  
  63.     function TurtleForward(a)
  64.         if Blocks < a then
  65.             turtle.forward()
  66.             turtle.turnLeft()
  67.             turtle.dig()
  68.             turtle.turnRight()
  69.             turtle.turnRight()
  70.             turtle.dig()
  71.             turtle.turnLeft()
  72.             Blocks = Blocks + 1
  73.             TurtleForward(a)
  74.         end
  75.     end
  76.  
  77.     function TurtleForwardN(a)
  78.         if Blocks1 < a then
  79.         turtle.forward()
  80.         Blocks1 = Blocks1 + 1
  81.         TurtleForwardN(a)
  82.     end
  83. end
  84.  
  85. Main()
Add Comment
Please, Sign In to add comment