felling turtle built in scripts --Lua code for minecraft felling turtle --For a very simple tree farm, --16 x 5 blocks, felling goes --down a single line and back --Apparently I cant find the built in libraries --.select(#) selects number of inventory, 1-16 --.getFuelLevel() returns fuel level --.refuel(#), refuels using # inventory item --.turn(#), turns the turtle, 90(1), 180(2). --.go(#), .forward(#)? felling turtle built in scripts How to get it? felling turtle built in scripts --.place(), places which inventory, selected --cntrl+T - shuts program down --cntrl+S - shuts down computer --cntrl+R - restarts computer --edit creates files with given name --type file in code to run function basicProtocol() location = 1 forward = true felling turtle built in scripts How to get it for free? felling turtle built in scripts fuel = turtle.getFuelLevel() print("In basic protocol") --FUNCTION CUT IT DOWN function cutItDown(turnNum) if (turnNum == 1) then turtle.turnRight() felling turtle built in scripts PasteShr felling turtle built in scripts else turtle.turnLeft() end while turtle.detect() do turtle.dig() print("Digging the block") turtle.up() print("Moving up") end felling turtle built in scripts How to get it for free? felling turtle built in scripts while not turtle.detect() and not turtle.detectDown() do turtle.down() print("Moving down") end print("Job done!") --turn back to normal print("Turning back to normal") felling turtle built in scripts How to dowload it? felling turtle built in scripts if (turnNum == 1) then turtle.turnLeft() else turtle.turnright() end return 0 end felling turtle built in scripts How to use it? felling turtle built in scripts print("After cut it down") --END FUNCTION CUT IT DOWN --FUNCTION CHECK FOR TREE function checkForTree() --tCheck tells turtle which turn there is a tree tCheck = 0 --check if tree on right felling turtle built in scripts How to get it for free? felling turtle built in scripts turtle.turnRight() if turtle.detect() then tCheck = 1 end --now check if tree on left turtle.turnLeft() turtle.turnLeft() if turtle.detect() then tCheck = 2 felling turtle built in scripts PasteShr felling turtle built in scripts end turtle.turnRight() return tCheck end print("After check for trees") --END FUNCTION CHECK FOR TREE felling turtle built in scripts PasteShr felling turtle built in scripts --FUNCTION MOVE function move(stripLength, location) if forward then if turtle.detect() then turtle.dig() end turtle.forward() felling turtle built in scripts How to use it? felling turtle built in scripts location = location + 1 forward = (location < stripLength) else if turtle.detect() then turtle.dig() end turtle.back() location = location - 1 forward = (location < 2) felling turtle built in scripts PasteShr felling turtle built in scripts return location end print("After move") --END FUNCTION MOVE haveFuel = fuel > 200 print("Do we have fuel?") print(haveFuel) felling turtle built in scripts How to get it for free? felling turtle built in scripts while haveFuel do print("in While loop") fuel = turtle.getFuelLevel() haveFuel = fuel > 200 stripLength = 16 felling turtle built in scripts How to use it? felling turtle built in scripts --we check for tree on each side --we cut it down if we find one treeDetected = checkForTree() if(treeDetected) then cutItDown(treeDetected) end -- and then we move location = move(stripLength, location) felling turtle built in scripts PasteShr felling turtle built in scripts --Refuel before we fall below 200 fuel = turtle.getFuelLevel() if (fuel < 300) then turtle.select(1) turtle.refuel() end end felling turtle built in scripts PasteShr felling turtle built in scripts --end basicProtocol end return 0 end print("Turtle ran out of fuel") turtle.select(1) turtle.refuel() basicProtocol() felling turtle built in scripts PasteShr felling turtle built in scripts felling turtle built in scripts