Ok, getting there now,
I have this as a Subroutine "HeightSense.tap"
#15239=1
G04 P0.5
G28.1 Z3.000
G92 Z0.000
#15239=0
G00 Z#15045
G92 Z0.000
M99
%
And the G-Code looks like,
N0190 M09 (Turn off extract fan)
N0200 M00 (Paused: Check the DTHC Settings - Hit RUN to continue)
N0210 G00 X36.000 Y17.475 Z15.000
N0220 M900 (Check for Z active) **this line will be removed soon - does nothing
N0230 M08 (Turn on extract fan)
N0240 M98 (HeightSense.tap)
N0250 G00 Z3.8000
N0260 M03
I tried to use a screen OEM LED numbered 1239 so i had a bit of bling but it would not work so i gave up on that and altered the brain to switch the output directly from the #15239 value and it works, the output has a button and LED on my screen anyway so i do get a little feedback as to where its at. I think this was the right way to go anyway as it's simpler.
One query - I pulled the var 1239/15239 from thin air - is there a way to see if vars are already used?

??
As the G-code loads you can see it run the macro at each call so I guess thats good?
The brain was the easy part, almost ladder-logic and i'm used to that from PLC programming.
Hardware changes next, this will have to wait until I return to work as all my pneumatic stuff is there

unless i get desperate and drive in to pick it up

From measurements, a 40mm stroke cylinder at 45deg will give plenty of safety clearance when retracted, 10mm bore is plenty as no power is required, it can easily be bolted to a bracket using bolts already in place on the floating head - this makes it an easy task to fit and remove if it fails.
As it stands right now I still have made massive improvements I think as the probing and IHS is now relative to the machine and NOT the g-code so any mechanical changes will mean not having to recreate my stock code files over - nice

Thanks for the guidance, especially at this time of year, been a fun project so far.