First, it should be:
mousexposition# = Mousex()
mouseyposition# = Mousey()
mousezposition# = Mousez()
That way, you will assign a value for the 3 variables.
Second, when you do that, Mousexposition - the z one, they will always be what you assigned them at the beginning.
do
if Mouseclick() = 1
hide mouse
print "This is the X position"
print mousex()
print "This is the Y position"
print mousey()
print "This is the Z position"
print mousez()
wait key
endif
cls
show mouse
loop
That will do what you want, also, please indent your code.
If you do not know how, look at this.
http://forum.thegamecreators.com/?m=forum_view&t=138230&b=10