<human>: William Dampier was born at Hymerford House in East Coker, Somerset, in 1651. He was baptised on 5 September, but his precise date of birth is not recorded. He was educated at King's School, Bruton. Dampier sailed on two merchant voyages to Newfoundland and Java before joining the Royal Navy in 1673.

In 1679, Dampier joined the crew of the buccaneer Captain Bartholomew Sharp on the Spanish Main of Central America, twice visiting the Bay of Campeche, or "Campeachy" as it was then known, on the north coast of Mexico. This led to his first circumnavigation, during which he accompanied a raid across the Isthmus of Darien in Panama and took part in the capture of Spanish ships on the Pacific coast of that isthmus. The pirates then raided Spanish settlements in Peru before returning to the Caribbean.  Dampier made his way to Virginia, where in 1683 he was engaged by the privateer John Cooke. Cooke entered the Pacific via Cape Horn and spent a year raiding Spanish possessions in Peru, the Galapagos Islands, and Mexico. This expedition collected buccaneers and ships as it went along, at one time having a fleet of ten vessels. Cooke died in Mexico, and a new leader, Edward Davis, was elected captain by the crew, taking the ship Batchelor's Delight, with future Captain George Raynor in the crew.  Dampier transferred to the privateer Charles Swan's ship, Cygnet, and on 31 March 1686 they set out across the Pacific to raid the East Indies, calling at Guam and Mindanao. Spanish witnesses saw the predominantly English crew as not only pirates and heretics but also cannibals. Leaving Swan and 36 others behind on Mindanao, the rest of the privateers sailed on to Manila, Poulo Condor, China, the Spice Islands, and New Holland. Contrary to Dampier's later claim that he had not actively participated in actual piratical attacks during this voyage, he was in fact selected in 1687 to command one of the Spanish ships captured by Cygnet's crew off Manila.  On 5 January 1688, Cygnet "anchored two miles from shore in 29 fathoms" on the northwest coast of Australia, near King Sound. Dampier and his ship remained there until March 12, and while the ship was being careened Dampier made notes on the fauna and flora and the indigenous peoples he found there. Among his fellows were a significant number of Spanish sailors, most notably Alonso Ramirez, a native of San Juan, Puerto Rico. Later that year, by agreement, Dampier and two shipmates were marooned on one of the Nicobar Islands. They obtained a small canoe which they modified after first capsizing and then, after surviving a great storm at sea, called at "Acheen" (Aceh) in Sumatra.  Dampier returned to England in 1691 via the Cape of Good Hope, penniless but in possession of his journals. He also had as a source of income a slave known as Prince Jeoly (or Giolo), from Miangas (now Indonesia), who became famous for his tattoos (or "paintings" as they were known at the time). Dampier exhibited Jeoly in London, thereby also generating publicity for a book based on his diaries. CANNOTANSWER

Using a quote from the above article, answer the following question: What happened during the trip?
<bot>: took part in the capture of Spanish ships on the Pacific coast of that isthmus.