players.name problem

Started by Slasher, Sat 17/10/2015 21:24:47

Previous topic - Next topic

Slasher

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

 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




Vincent

I believe you can use a global String..
Code: ags

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

Crimson Wizard

#2
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

// 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

Player.Name = Player_name;

Slasher

#3
It's ok guys,

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

fingers crossed (laugh)

cheers

SMF spam blocked by CleanTalk