Advertisement
M0n5t3r

RubberTree

Jul 17th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.08 KB | None | 0 0
  1. local sapslot = 1
  2. local rubslot = 2
  3. local fuelslot = 3
  4.  
  5. local function fuelcheck()
  6.  
  7.         if turtle.getItemCount(3) <1 then
  8.             turtle.select(3)
  9.             sleep(0.2)
  10.             turtle.down()
  11.             sleep(0.2)
  12.             turtle.turnLeft()
  13.             sleep(0.2)
  14.             turtle.turnLeft()
  15.             sleep(0.2)
  16.             turtle.suck()
  17.             sleep(0.2)
  18.         end
  19.         repeat
  20.             turtle.drop(1)
  21.             sleep(0.2)
  22.         until
  23.                 turtle.getItemCount() == 5
  24.         end
  25.  
  26.         turtle.turnRight()
  27.         sleep(0.2)
  28.         turtle.turnRight()
  29.         sleep(0.2)
  30.         turtle.up()
  31.         sleep(0.2)
  32.         print("Got the fuel")
  33.         sleep(0.3)
  34. end
  35.  
  36.  
  37. local function sapcheck()
  38.  
  39.         if turtle.getItemCount(1)<1 then
  40.                 turtle.select(1)
  41.                 sleep(0.2)
  42.                 turtle.down()
  43.                 sleep(0.2)
  44.                 turtle.turnRight()
  45.                 sleep(0.2)
  46.                 turtle.suck()
  47.                 sleep(0.2)
  48.         end
  49.         repeat
  50.                 turtle.drop(1)
  51.                 sleep(0.2)
  52.         until
  53.                 turtle.getItemCount() == 1
  54.         end
  55.  
  56.         print("Got the sapplings")
  57.         sleep(0.3)
  58. end
  59.  
  60. local function rubcheck()
  61.  
  62.         if turtle.getItemCount(2) <1 then
  63.                 turtle.select(2)
  64.                 sleep(0.2)
  65.                 turtle.down()
  66.                 sleep(0.2)
  67.                 turtle.turnRight()
  68.                 sleep(0.2)
  69.                 turtle.suck()
  70.                 sleep(0.2)
  71.         end
  72.         repeat
  73.                 turtle.drop(1)
  74.                 sleep(0.2)
  75.         until
  76.                 turtle.getItemCount() == 1
  77.         end
  78.  
  79.                 turtle.turnRight()
  80.                 sleep(0.2)
  81.                 turtle.turnRight()
  82.                 sleep(0.2)
  83.                 turtle.up()
  84.                 sleep(0.2)
  85.                 print("Got the rubber")
  86.                 sleep(0.3)
  87.  end
  88.  
  89.  
  90. local function felling()
  91.                 if turtle.detect() then
  92.                         turtle.dig()
  93.                         sleep(0.2)
  94.                         turtle.forward()
  95.                         sleep(0.2)
  96.                 end
  97.  
  98.                 repeat
  99.                         turtle.digUp()
  100.                         sleep(0.2)
  101.                         turtle.dUp()
  102.                 until
  103.                         not turtle.detect()
  104.                 end
  105.                
  106.                 repeat
  107.                         turtle.down()
  108.                         sleep(0.2)
  109.                 until
  110.                         turtle.detect()
  111.                
  112.                
  113.                         turtle.digDown()
  114.                         sleep(0.2)
  115.                         turtle.select(1)
  116.                         sleep(0.2)
  117.                         turtle.place()
  118.                         sleep(0.2)
  119.                         turtle.back()
  120.                         sleep(0.3)
  121.  
  122. end
  123.  
  124. local function main()
  125.     fuelcheck()
  126.     rubcheck()
  127.     sapcheck()
  128.     felling()
  129. end
  130.  
  131. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement