local SLOT_COUNT = 16 function getItemIndex(itemName) for slot = 1, SLOT_COUNT, 1 do local item = turtle.getItemDetail(slot) if(item ~= nil) then if(string.match(item.name, itemName)) then return slot end end end end function getWood() turtle.suck() while(true) do woodIndex = getItemIndex("log") if(woodIndex == nil) then turtle.suck() turtle.drop() else turtle.select(woodIndex) turtle.dropUp() return true end end return true end function orientate() while true do x, table = turtle.inspect() if not string.match( table.name,"chest" ) then turtle.turnLeft() else return true end end end