Troon is in Ayrshire now, but pretty sure it was once part of Larnarkshire.
I very much doubt that Troon was ever in the County of Lanark, and it was certainly not in Lanarkshire (which is the same thing) in Charles' lifetime.
From Fullarton's Gazetteer (1842): "Troon: a promontory, a harbour, a thriving sea-port and a
quoad sacra parish, at the west end of the parish of Dundonald, Ayrshire .... is by far the best natural harbour in Ayrshire .... The merchants of Glasgow, aware of its advantages, made a vain effort, about the year 1700,to purchase the adjacent property for the erection of a sea-port; and, in consequence of the repulse they met, were obliged to select the very inferior site of Port Glasgow ...."