Combining a string and text (or two strings)

Started by arj0n, Tue 18/11/2008 10:53:48

Previous topic - Next topic

arj0n

I'm using AGS 3.1

I have an input box to get the game player name.
The name input is a string

I would like to display the text "welcome " followed by the name.

It would be something like this but the last line doesn't work...

function cEgo_Talk()
String A = Game.InputBox("!What is your name?");   
String B = ("Welcome ");
Display (BA&);

Should I use .append?

Gilbert

If you don't need to keep the formatted text, just format it directly in the Display() line.

function cEgo_Talk(){
  String A = Game.InputBox("!What is your name?");   
  Display ("Welcome %s", A);
}

See the manual for more details.

Dualnames

function cEgo_Talk()
String A = Game.InputBox("!What is your name?");   
String B = "Welcome ";
B=B.Append(A);
Display (B);

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

arj0n


SMF spam blocked by CleanTalk