Answered half of my question -
I forgot that the motion code call would return before the move completed, so the offset is reset to G54 before the move completes.
The correct code is
code ("G59")
code (G0 x0 y0 z0)
while (IsMoving())
sleep(100)
wend
code ("G54")
I'd still be interested in learning how to save and restore the current fixture setting.