How to create firstname and surname in one line?

I am trying to put firstname and surname choices in my game, and have it in choicescript_stats in one line.

I read all topics about this, but still don’t get how to do it…

I want to have during gameplay in “show stats” this:

     Name: John Smith   (or just without Name:) John Smith.

In startup I have:

*create firstname "firstname" 
*create surname "surname"
*create name  (firstname&" ")&surname

What is your name?
*fake_choice

 #Maximilian
  *set name "Maximilian"
 #Octavian 
  *set name "Octavian"
 
 #I want to choose my own name.
   *input_text name


And your surname?
*fake_choice
 #Chastel
  *set surname Chastel
 #I want to choose my own surname.
   *input_text surname

And in choicescript_stats:

*stat_chart
 Name: (firstname&" ")&surname

Name: ${firstname} ${surname}

You don’t need to create the name variable in this case.

EDIT:

${} will produce the variable as it's written, so if the name is all lower case, it will show it all lowercase
$!{} will produce the first letter as upper case
$!!{} will have all of the thing in upper case
1 Like

It still don’t work. Now I have this mistake:

"choicescript_stats line 2: invalid line; this line should start with 'percent', 'text', or 'opposed_pair' "

line2 is: Name: !{firstname} !{surname}

In choicescript_stats I have:

*stat_chart
   Name: $!{firstname} $!{surname}

And in startup:

*create firstname "firstname" 
*create surname "surname"


What is your name?
*fake_choice

 #Maximilian
  *set name "Maximilian"
 #Octavian 
  *set name "Octavian"
 
 #I want to choose my own name.
   *input_text name


And your surname?
*fake_choice
 #Chastel
  *set surname Chastel
 #I want to choose my own surname.
   *input_text surname

You could do it how @MeltingPenguins proposed, which is how I personally do it. Bu if you must create a different variable for it, then you must reset it after the name and surname have been selected.

In the startup:

*create name "" 
*create surname "" 
*create fullname "" 

Then during gameplay after both the name and surname have been selected you include the line

*set fullname (name&" ")&surname

Remove the *stat_chart if your doing it like that.

The difference is that *stat_chart demands a single variable. What you’re doing is writing a simple line of text and printing the variables values on it.

If you want to use *stat_chart, then do it like this:

*stat_chart
      text fullname Name

The output should be:

Name: Maximilian Chastel

Alternatively, you can do:

Name: $!{name} $!{surname}

And the output will also be:

Name: Maximilian Chastel
2 Likes

Ah, you don’t need to put a

*stat_chart

there if you want to use my suggestion.
That comes once you want to show the stats:

Name: $!{firstname} $!{surname}

*stat_chart
   percent yourstathere YourStatsName
1 Like

@MeltingPenguins and @cup_half_empty
Thanks both of you. It worked perfectly now!

2 Likes

Question resolved!