Guest User

charcoal

a guest
Dec 3rd, 2013
97
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("sap")
  11. boneLevel = turtle.getItemCount("bone")
  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.  
  30. function resetPos()
  31.   while not turtle.detectDown() do
  32.    turtle.down()
  33. end
  34.  
  35. function dump()
  36.   turtle.select("dump")
  37.   turtle.place()
  38.   turtle.select(3)
  39.   turtle.drop()
  40.   turtle.select(8)
  41.   turtle.drop()
  42.   turtle.select(9)
  43.   turtle.drop()
  44.   turtle.select(10)
  45.   turtle.drop()
  46. end
  47.  
  48. function getSap()
  49.  if sapLevel < 16 then
  50.   turtle.select("sChest")
  51.   turtle.place()
  52.   turtle.select("sap")
  53.   turtle.suck()
  54.   turtle.select("sChest")
  55.   turtle.dig()
  56. end
  57.  
  58. function getBone()
  59.   if boneLevel < 16 then
  60.   turtle.select("bChest")
  61.   turtle.place()
  62.   turtle.select("bone")
  63.   turtle.suck()
  64.   turtle.select("bChest")
  65.   turtle.dig()
  66. end
  67.  
  68. function fuelUp()
  69.  if fuelLevel < 100 then
  70.  turtle.select("fChest")
  71.  turtle.place()
  72.  turtle.select("fuel")
  73.  turtle.suck()
  74.  turtle.refuel()
  75.  turtle.select("fChest")
  76.  turtle.dig()
  77. end
  78.  
  79. --Main Program
  80. while true do
  81.     turtle.getSap()
  82.     turtle.fuelUp()
  83.     turtle.getBone()
  84.     turtle.plant()
  85.     turtle.grow()
  86.     turtle.dig()
  87.     turtle.forward()
  88.     turtle.chop()
  89.     turtle.resetPos()
  90.     turtle.back()
  91.     turtle.dump()
  92.     os.sleep(180)
  93. end
Advertisement
Add Comment
Please, Sign In to add comment