Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script created by Zehdari
- -- Setting the height to 0
- local height = 0
- -- Creating the refuel function
- local function refuel()
- if turtle.getFuelLevel() < 20 then
- for a = 1,16 do
- if turtle.getFuelLevel() < 20 then
- turtle.select(a)
- if turtle.refuel(a) then
- for q = 1, turtle.getItemCount(a) do
- if turtle.getFuelLevel() < 20 then
- turtle.refuel(a)
- end
- end
- end
- end
- end
- turtle.select(1)
- end
- end
- -- Saying that the script has started
- print "Cutting..."
- -- Creating the beginning cut function
- local function cut()
- turtle.dig()
- refuel()
- turtle.forward()
- turtle.dig()
- end
- -- Creating the function to cut upwards, until reaching the top
- local function detectup()
- while turtle.detectUp() do
- turtle.digUp()
- refuel()
- turtle.up()
- turtle.dig()
- height = height + 1
- end
- end
- -- Creating the function to turn once reached the top
- local function turn()
- turtle.turnRight()
- turtle.dig()
- refuel()
- turtle.forward()
- turtle.turnLeft()
- end
- -- Creating the function to dig and go downwards
- local function down()
- for i = 1,height do
- turtle.dig()
- turtle.digDown()
- refuel()
- turtle.down()
- end
- end
- -- Calling the functions
- cut()
- detectup()
- turn()
- down()
- turtle.dig()
- -- Info for the owner
- print "Tree cut successfully."
- print ("Fuel level is: "..turtle.getFuelLevel())
Advertisement
Add Comment
Please, Sign In to add comment