Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Sat 17/10/2015 21:24:47

Title: players.name problem
Post by: Slasher on Sat 17/10/2015 21:24:47
Hi,

i have used input to capture players name.

However, the actual player is unseen and the player characters are one of two.

I do not want their name shown as it displays actual players inputted name.

so i used:

Code (ags) Select

if (Character.GetAtScreenXY(mouse.x, mouse.y)==cGChef) { // could be selected as player
player.Name="";
}
if (Character.GetAtScreenXY(mouse.x, mouse.y)==cBChef) { // could be selected as player
  player.Name="";
}
}


But of course that overrides String players.name.

is there a way round it.

thanks



Title: Re: players.name problem
Post by: Vincent on Sat 17/10/2015 21:57:31
I believe you can use a global String..
Code (ags) Select

String Player_name; // you use the String to define the name

// then you can do something like this
Player.Name = String.Format("%s", Player_name);

// you can set this string how you prefer
Player_name = "";
Player_name = "Chef A";

// and if you need you can use to check the name if it is empty or null with String.IsEmptyOrNull
Title: Re: players.name problem
Post by: Crimson Wizard on Sat 17/10/2015 22:18:21
Quote from: slasher on Sat 17/10/2015 21:24:47
I do not want their name shown as it displays actual players inputted name.
Shown where? What does display player name? :confused:
You do not want another name shown, or you do not want any name shown at all? :confused:


Quote from: Vincent on Sat 17/10/2015 21:57:31
Code (ags) Select

// then you can do something like this
Player.Name = String.Format("%s", Player_name);

You do not need String.Format to assign one string to another. You just do
Code (ags) Select

Player.Name = Player_name;
Title: SOLVED: Re: players.name problem
Post by: Slasher on Sat 17/10/2015 22:38:05
It's ok guys,

I've figured a way around it with those scripts.

fingers crossed (laugh)

cheers