A jury in Perth was told how a bungled attempt to collect drugs from a bulk carrier led investigators to a $500 million haul of cocaine.