Answer based on context:

The former supporters of James III under the leadership of John Stewart, 1st Earl of Lennox met up at Dumbarton Castle in October 1489. They had hoped to gain the support of Henry VII of England. James IV defeated them in a battle between the Touch and Menteith hills near Stirling on 11 and 12 October. James IV used Dumbarton as the west coast base for his navy and campaigns to subdue the Western Isles. James was at Dumbarton with the Chancellor of Scotland, Colin Campbell, 1st Earl of Argyll, in November 1489. He had the use of a ship belonging to the Laird of Luss. In the following February a royal ship was 'chaysit' by the English and lost some of her cables. In 1494 a row barge was built at Dumbarton for the king using timber from Loch Lomond. In March 1495 James IV was provided with a camp bed for use at sea and a boat carried cannon to Dumbarton. Patrick Hepburn, 1st Earl of Bothwell, was made Captain of the castle on 1 April 1495. A man played on the clarschaw, a Gaelic harp, for the King. In 1505 Dumbarton was the King's base for visiting the Western Isles. One ship's mast was made from timber from Drymen. On 5 June James was entertained by a French 'quhissilar', perhaps playing a recorder and on 8 June James played cards with John Murray and Master Robert Cockburn losing £4-10 shillings, and later that day attended Evensong in the Parish kirk and College of Dumbarton. In 1505 John Ramsay built a ship for the King called the Columb, . In December 1505 a sword that had belonged to William Wallace was repaired.

Which happened first, Hepburn being made Captain of the castle, or John Ramsey building a ship for the King?
Hepburn