I’m having trouble with this code of mine. I tried copying the way “Choice of Dragon” did this section, but somewhere I went wrong. I’m at the naming section of my script and it works as planned with the names I inputted, but it doesn’t work with the entered name. It lets the player input their name as normal, but then it goes straight to the end as if I put the command *finish.
My code looks like this:
*choice #Adam
*set name “Adam”
*goto gender #Alexandria
*set name “Alexandria”
*goto gender #Claire
*set name “Claire”
*goto gender #Damien
*set name “Damien”
*goto gender #Levi
*set name “Levi”
*goto gender #Robin
*set name “Robin”
*goto gender #I’d like to input my own name…
Oh! Of course.
*label input_name
What is your name?
*input_text name
*if ("${name}" != "$!{name}")
Your name is $!{name}, is that right?
*choice
#Yes
*set name "$!{name}"
*goto gender
#No
*goto input_name
*goto gender
What does the code do when the inserted name is already capitalized? I don’t see that bit of code here.
It’s probably falling out of a choice or if-statement somewhere. (Like, taking a wrong turn because the signpost telling the code where to go is missing or not in the right spot.)
I honestly don’t know, I was trying to focus on copying how Choice of Dragons did it, but I think I copied it a bit too literally. Thank you for your answer!
also pinging @Alex1897 since this might be relevant
choicescript isn’t case sensitive, if you want a variable to be printed as they input it, you would use ${name}, if you want to print it with the first letter capitalized, you can use $!{name} and it will automatically capitalize the first letter of the string value.
The if statement is just checking if whatever the input value is equals itself.
To add onto this, if you wanted to set the input to the capitalized value you could use *set name "$!{name}"
Tell me if this code does what you are looking for.
*fake_choice
#Adam
*set name "Adam"
*goto gender
#Alexandria
*set name "Alexandria"
*goto gender
#Claire
*set name "Claire"
*goto gender
#Damien
*set name "Damien"
*goto gender
#Levi
*set name "Levi"
*goto gender
#Robin
*set name "Robin"
*goto gender
#I’d like to input my own name…
Oh! Of course.
*label input_name
What is your name?
*input_text name
Your name is $!{name}, is that right?
*fake_choice
#Yes
*set name $!{name}
*goto gender
#No
*goto input_name