Game Development Community

What's My ID?!?!

by Welias D. Willie II · in Torque Game Engine · 12/12/2004 (4:58 pm) · 6 replies

Ok this is sad and I am sure I am overlooking the obvious. Maybe it is just too late or I have been looking at code too long.

How do I get my local client's id? I have a GUI that launches a function in playGui.cs and I have tried these variations to find my clientID:

function calledFunctionFromGUI(%this){ 
     echo("My Client ID: " @ %this);
}

function calledFunctionFromGUI(%this){ 
     echo("My Client ID: " @ %this.player);
}

function calledFunctionFromGUI(%this){ 
     echo("My Client ID: " @ $player); // did not find this set globally anywhere  but what the heck
}

function calledFunctionFromGUI(%this){ 
     echo("My Client ID: " @ %this.client);
}

Keep in mind this is all client side, no calls to the server. Surely it is stupid easy and I am missing something here.

#1
12/12/2004 (5:04 pm)
Forgive me if I'm being dumb... getId();
#2
12/12/2004 (5:10 pm)
No I am sure it is something really dumb that I am doing.

I guess I should also note that %this doesn't have a value at all. So %this.getID(); will not work either.
#3
12/12/2004 (5:17 pm)
I don't think the client knows his own id.

If you can't figure it out, you could always just have the server do a commandtoclient to tell the client what his id is, and just store the id in a global.
#4
12/12/2004 (5:18 pm)
The server connection is declared globally.

serverConnection.getId();
#5
12/12/2004 (5:24 pm)
Bleh, double posted
#6
12/12/2004 (5:26 pm)
%client = serverConnection.getId();

did the trick! Thanks!