Guest User

charcoal

a guest
Dec 3rd, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.67 KB | None | 0 0
  1. --Variables
  2. sap = 1 --Sapling slot
  3. bone = 2 --Bone meal slot
  4. fuel = 3 --Fuel slot
  5. sChest = 4 --Sapling chest slot
  6. bChest = 5 --Bone meal chest slot
  7. fChest = 6 --Fuel chest slot
  8. dump = 7 --Item export chest slot
  9. fuelLevel = turtle.getFuelLevel()
  10. sapLevel = turtle.getItemCount(1)
  11. boneLevel = turtle.getItemCount(2)
  12. --Functions
  13.  
  14. function plant()
  15.   turtle.select("sap")
  16.   turtle.place()
  17. end
  18.  
  19. function grow()
  20.   turtle.select("bone")
  21.   turtle.place()
  22. end
  23.  
  24. function chop()
  25.    while turtle.detectUp() do
  26.    turtle.digUp()
  27.    turtle.up()
  28. end
  29. end
  30. function resetPos()
  31.   while not turtle.detectDown() do
  32.    turtle.down()
  33. end
  34. end
  35.  
  36. function dump()
  37.   turtle.select("dump")
  38.   turtle.place()
  39.   turtle.select(3)
  40.   turtle.drop()
  41.   turtle.select(8)
  42.   turtle.drop()
  43.   turtle.select(9)
  44.   turtle.drop()
  45.   turtle.select(10)
  46.   turtle.drop()
  47. end
  48.  
  49. function getSap()
  50.  if sapLevel < 16 then
  51.   turtle.select("sChest")
  52.   turtle.place()
  53.   turtle.select("sap")
  54.   turtle.suck()
  55.   turtle.select("sChest")
  56.   turtle.dig()
  57. end
  58. end
  59. function getBone()
  60.   if boneLevel < 16 then
  61.   turtle.select("bChest")
  62.   turtle.place()
  63.   turtle.select("bone")
  64.   turtle.suck()
  65.   turtle.select("bChest")
  66.   turtle.dig()
  67. end
  68. end
  69. function fuelUp()
  70.  if fuelLevel < 100 then
  71.  turtle.select("fChest")
  72.  turtle.place()
  73.  turtle.select("fuel")
  74.  turtle.suck()
  75.  turtle.refuel()
  76.  turtle.select("fChest")
  77.  turtle.dig()
  78. end
  79. end
  80. --Main Program
  81. while true do
  82.     turtle.getSap()
  83.     turtle.fuelUp()
  84.     turtle.getBone()
  85.     turtle.plant()
  86.     turtle.grow()
  87.     turtle.dig()
  88.     turtle.forward()
  89.     turtle.chop()
  90.     turtle.resetPos()
  91.     turtle.back()
  92.     turtle.dump()
  93.     sleep(180)
  94. end
Advertisement
Add Comment
Please, Sign In to add comment