Capitalizing all variables in a concatenation

Hello I have a question that I just cannot figure out. I have the concatenation of first and last name sorted.

*set fullname (first_name&” “)&last_name

Works great. Perfect. BUT what do I do if someone inputs the last name variable as lowercase?? I’ve been operating off $!{first_name} to prevent lower case inputted names, but that doesn’t seem to apply to concatenated variables.

Am I doomed to $!{first_name} $!{last_name}? Thanks for listening to me cry.


Maybe make a temp variable called last_name_capital? Then it’s an easy (first_name&” “)&last_name_capital

Hmmm. Do you mean like…

# Write my own name.
    *input_text last_name

*set last_name_captial (!"last_name") 

or… something. I don’t know how that would actually look to make it capitalized. :’)

You don’t need to concatenate. The code can evaluate variable calls even within a *set command, so you can just do the following:

*set fullname "$!{first_name} $!{last_name}"

You could also just do this to obviate the capitalization issue altogether:

*input_text last_name
*set last_name "$!{last_name}"

And this will make it so last_name is always the capitalized version of whatever the player wrote.

10 Likes

Oh my GOD. You’ve shaved years of stress off my life. Also the cumulative hours saved since I no longer need to add ! into every name instance… the tears of relief I am crying. THANK YOU.

6 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.