Displaying the full name in the stat screen after seperately choosing given name and last name

So i was having trouble with displaying the full name in stats section so i came up with a simple code and a simple tutorial on it. I checked the related topics and saw it is explained there but there are not a pre-written code that one can copy past and edit as they will so im posting it here just to give them something to work on and a little understanding on variables.

As choicescript wont recognize two variables in one string, you just need to turn those variables into one variable. All explained below.

P.S: If you find this topic unnecessary, it can be deleted.

*comment =========================================================================================================================================
*comment This code will let you give a choice to the reader to choose their given name and last name seperately and then turn it into one variable so you can display the full name in stats section.
*comment =========================================================================================================================================

*comment The part below will go to the top of the startup file.
*comment ------------------------------------------------------------

*create givenname "unknown"
*create lastname "unknown"
*create Name "unknown"

*comment -------------------------------------------------------------

*comment After creating the three variables above, you will need to go to choicescript_stats file and type this simple code below *stat_chart .

*stat_chart
    text Name
    
*comment You won't repeat *stat_chart command. You will probably have that section there. Just type --> text Name    below that section. Mind indentation!



*comment Now the code below will set up your name choice so just change the first three options with whatever you want and copy past it.

*comment A little note on this. You can't display the full name by typing --> text ${givenname} ${lastname} in the stats as choicescript won't recognize such comand.
*comment So you're just basically creating a seperate variable "Name" to be able to display characters full name in stats screen.

*comment This should do the trick.

*label input_givenname
*choice
    #Pre-given
        *set givenname "Pre-given"
        *goto givenname_check
    #given_names
        *set givenname "given_names"
        *goto givenname_check
    #Here
        *set givenname "Here"
        *goto givenname_check
    #None of these, let me choose my own given name.
        What's your given name then?
        *input_text givenname
        *set givenname "${givenname}"
        *goto givenname_check
    
*label givenname_check
Your given name is ${givenname} , did i get it correct?
*choice
    #Yes, indeed.
        *goto input_lastname
    #No, how hard it could be to get my name correctly!
        You're right. Im sorry…
        *goto input_givenname
    
*label input_lastname
*choice
    #Pre-given
        *set lastname "Pre-given"
        *goto lastname_check
    #given_lastnames
        *set lastname "given_lastnames"
        *goto lastname_check
    #Here
        *set lastname "Here"
        *goto lastname_check
    #None of these, let me chose my own last name.
        What's your last name then?
        *input_text lastname
        *set lastname "${lastname}"
        *goto lastname_check
    
*label lastname_check
Your last name is ${lastname} , did i get it correct?
*choice
    #Yes, indeed.
        *goto Name_check
    #No, how hard it could be to get my last name correctly!
        You're right. Im sorry…
        *goto input_lastname
    
*label Name_check
Your name is ${givenname} ${lastname} , did i get it correct?
*choice
    #Yes, indeed.
        *set Name "${givenname} ${lastname}"
        *finish
    #No, how hard it could be to get my name correctly!
        You're right. Im sorry…
        *goto input_givenname
        
        
        
*comment You can delete the check sections but you will need to change "goto" commands due to your labels. 
*comment I think it wont be of any harm to double check the choices :) 

Hmmm…
what exactly was the problem you encountered?
cause usually

$!{first_name} $!{lastname}

should work just fine. (whether or not you have a ! after the $ or not)

1 Like

The problem was to display full name in the stats screen but you cant code it there with ${} or @{} this since choicescript wont recognize it. So instead i turned two variables into one as obviously most people do. I just wanted to post the structure of the code so people can copy past and play around it :slight_smile:

I think most people do use two variables for the mc’s name…

On the stats page, you don’t need to use a stat_chart to display the text.

Try this:

${givenname} ${lastname}

*stat_chart
  percent strength
  number height

etc.

It works fine and there is no need to set more variables.

2 Likes

Thanks for the code, @needs-to-be-loved, but as others mentioned, there’s no need to do this.

Yes, you can’t

*stat_chart
   text ${givenname} ${lastname}

but you can

Name : ${givenname} ${lastname}

No offense, but I’m afraid that your code may complicate things that shouldn’t be that complicated.

It’s about creativity, afterall. Sometimes, you don’t even need the *stat_chart command in your stats screen.

1 Like

@MeltingPenguins @andymwhy @Szaal

I didn’t know it and this was the way i could think of. So as there is an easier way, no need to complicate things as you said. I would withdraw the topic but i think i dont have permission to do that. So someone who is able to do that can withdraw it now, there is no need for confusions. And if i can delete it please show how to.

Thanks for all the attention :slight_smile:

2 Likes

Oh I’d say leave the topic open.
Other people might have a similar problem in the future, who knows.

3 Likes

Ok then, just leave it like this.