So I took a few steps back and deleted a bunch of code as it was quickly turning into spaghetti,
I have managed to rewrite the sequencer and metronome but when it comes to automatically saving the state of a toggle to [text -k define $0-sequences] something is wrong.
I can see the state changes If I was to open the object manually but they never seam to write.
Any so of advice is greatly appreciated.