Game Development Community

Obtaining the player's name

by Todd Wilkinson · in Torque Game Engine · 07/31/2006 (12:42 pm) · 4 replies

Hi all, I've recently implemented my own version of a Team/Faction selection process that is only going to be called for new players to the server. After that, when that player enters the server, they will load from where they left off (it's a persistent world game).

My problem right now is that I check to see if they've been to the server before by looking for their save game file. I store these files in /server/characters/[character name].cs

Therefore, in order to load or save, or even check for the file, I have to have the player's name. For the team select process, they have not spawned yet because the team they choose will determin many things about their player including what models they will use or have access to.

Up until this point I have been using %client.player.getShapeName() and stripping the control characters to find the player's name. However, the player's don't have a shape yet in this instance so that function will not work.

GameConnection::createPlayer assigns the shape name by passing %player.setShapeName() the %this.name variable. However, any attempt by me to use this has resulted in nothing but control characters. I'm assuming the engine is picking up some slack here, but I am not sure.

So, my question to all of you is: How can I get the player's name before they spawn?

Thanks for any and all help!

About the author


#1
07/31/2006 (12:50 pm)
%client.name is how I would do it. %client being the appropriate GameConnection object
#2
07/31/2006 (4:35 pm)
%client.name is a tagged string you would want to use %client.nameBase which is plain text.
#3
07/31/2006 (10:41 pm)
Thanks to you both! Both worked just fine. I opted for %client.nameBase as it had one less step.
#4
07/31/2006 (11:59 pm)
Thanks to you both! Both worked just fine. I opted for %client.nameBase as it had one less step.