Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- local boneCountMin = 32
- local saplingCountMin = 5
- local boneTries = 32
- local boneIndex = 1
- local saplingIndex = 2
- local storageIndex = 3
- -- Stats
- local treesCut = 0
- local saplingsUsed = 0
- local bonemealUsed = 0
- local logsDeposited = 0
- local logsPerTree = 0
- print("Place bonemeal in slot " .. boneIndex)
- print("Place saplings in slot " .. saplingIndex)
- print("slots " .. storageIndex .. ".. 16 are for storage")
- print("Press enter to begin")
- io.read()
- print("Beginning...")
- -- Functions
- function DisplayStats()
- print("")
- print("Logging Stats")
- print("Total Logs: " .. logsDeposited)
- print("Total Trees: " .. treesCut)
- print("avg log/tree: " .. logsPerTree)
- print("Bonemeal Used: " .. bonemealUsed)
- print("Saplings Used: " .. saplingsUsed)
- end
- function Deposit(s, e)
- treesCut = treesCut + 1
- local count = 0
- for i = s, e do
- turtle.select(i)
- count = count + turtle.getItemCount()
- turtle.drop()
- end
- logsDeposited = logsDeposited + count
- logsPerTree = logsDeposited / treesCut
- print("Deposited " .. count .. " logs")
- end
- function Bone(idx)
- turtle.select(idx)
- local bstart = turtle.getItemCount()
- for i = 0, boneTries do
- turtle.place()
- end
- local bend = turtle.getItemCount()
- bonemealUsed = bonemealUsed + (bstart - bend)
- end
- function Plant(idx)
- turtle.select(idx)
- turtle.place()
- saplingsUsed = saplingsUsed + 1
- end
- function Resupply()
- turtle.turnLeft()
- turtle.select(boneIndex)
- while (turtle.getItemCount() < boneCountMin) do
- turtle.suck(1)
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(saplingIndex)
- while (turtle.getItemCount() < saplingCountMin) do
- turtle.suck()
- end
- turtle.turnLeft()
- end
- -- Main
- sleep(1)
- while (true) do
- DisplayStats()
- print("Beginning iteration " .. treesCut)
- Resupply()
- Plant(saplingIndex)
- Bone(boneIndex)
- turtle.dig()
- turtle.forward()
- local h = 0
- while(turtle.detectUp()) do
- turtle.digUp()
- turtle.up()
- h = h + 1
- end
- for i = 0, h do
- turtle.down()
- end
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- Deposit(storageIndex, 16)
- turtle.turnRight()
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement