I was just looking at the SKILL code I have which does something similar. Unfortunately it contains a lot of things specific to the customer I wrote it for, as well as a whole bunch of other things which make the code too complex an example to post.
And I don't have time for the next week or two to produce a cut down, simplified example.
Perhaps somebody else can post something...
The general idea is that you would do something like:
; iterate over all the pins for this terminal
; only do this if there aren't more than one inst term
; location within the instance master
; transform to the top level coordinate system
; calculate the overall transform to move the pin to the new location
transform=dbConcatTransform(list(-xCoord(pinFigLocation):-yCoord(pinFigLocation) "R0" 1) location)
Note this is completely off the top of my head, with no testing. Indentation may be a bit awry because I just typed it into the browser.