The Lonely Piper was the disguise of Hamish.
Physical appearance[]
It is a gray skinned ghost with fangs. It was dressed in a black Scottish bagpipe player uniform and carried around the instrument.
Personality[]
It's mostly emotionless, but also a frightening individual do to it's ability in summoning large tentacle rays to do it's work.
History[]
Scooby-Doo! World of Mystery[]
It showed up immediately after Hamish left to go check on the crown jewels and played it's bagpipes, summoning a tentacle rays that picked up the gang, along with Captain McGregor and carried them out of Edinburgh Castle, locking them out.
It later stalked after Shaggy and Scoob while the rest of the gang went to try and find a way back inside, targeting them with another tentacle ray in an attempt to carry them further away from the castle. But ended up getting parts of the pipe blocked off when Shaggy dropped a few Scooby Snacks into it.
For whatever reason, it left the two alone and went back into the castle (through a path Fred and the girls used to get back inside) and used a giant ray to control various weapons from knights armor to attack them, the three regrouped with Shag and Scoob and discovered it stealing the crown. They scattered around the room to try and get it to grab random items until Shaggy bumped into a wall, leading him blinded by a bagpipe landing on his head, it made a loud noise causing it to summon a tentacle ray of its own and made the ghost drop theirs and cover their ears.

Hamish the historian unmasked.
They then reveal the ghost to be Hamish, he had used the disguise to scare off the soldiers and their captain so he could steal the crown jewels. The bagpipe had a device inside it that he invented to summon the tentacle rays.
He was later arrested shortly after for theft.