As you have found variables do not work the way you are suggesting.
In this code:
function niceFunction()
localGX as MyType
if myCondition
localGX = gX1
else
localGX = gX2
endif
localGX.x = 100 //this line does not have the effect I was hoping it to
gX2.x = 100
endfunction
you are thinking that this line:
localGX = gX1
somehow makes localGX becomes a "pointer" to gX1, and so in other words anything assigned to localGX gets assigned to gX1.
But what only happens is that the value of gX1.x is put into the local variable localGX.x
Nothing is getting put into the global gX1 and the local variable localGX is gone after niceFunction is finished.
Without knowing the big picture of the purpose of the code, this may not be what you want, but is the following of any use?
function niceFunction()
if myCondition
gX1.x = 100
else
gX2.x = 100
endif
gX2.x = 100
endfunction