How do you set name, gender, hair color, etc.?

I just know I’m missing something obvious, but I have no idea how to set name, gender hair color, and other such options. I looked at some other posts and examined the code for a few games, but I can’t figure out what I’m doing wrong. :grimacing:

This is some of the code I used for the stats:

*label stats_screen
text Name: $!{name}
text Gender: $!{gender} 
text Hair color: $!{hair} 
text Eyes: $!{eyes} 

and this is what I used at startup:

*create name ""
*create compassion 50
*create integrity 50
*create bravery 50
*create agility 0
*create strength 0
*create intelligence 0
*create charisma 0
*create magic 0
*create gender "unknown"
*create hair "unknown"
*create eyes "unknown"

(later on during naming)

*label naming
*page_break
What is your name?
*input_text name
*comment check capitalization
*if ("${name}" != "$!{name}")
*goto gender
*label gender
*page_break
What is your gender?
*choice
	#Male
		*set gender "Male"
		*goto hair
	#Female
		*set gender "Female"
		*goto hair
	#Other
		*set gender "Neither/Unknown"
		*goto hair

*label hair
*page_break
What color is your hair?
*choice
	#Black
		...
	#Brown
		...
	#Blond
		...
	#White
		...
	#Red

and it all comes out like this:
text Name: text Gender: Unknown text Hair color: Unknown text Eyes: Unknown

How do I fix this?

Please wrap your code in ```.

The issue I see is that you have an *if statement checking the capitalization of the player’s name that leads to the gender choice, but if the name variable is capitalized, then nothing happens. Not sure what’s really going on there.

*label stats_screen
text Name: $!{name}
text Gender: $!{gender} 
text Hair color: $!{hair} 
text Eyes: $!{eyes} 
*create name ""
*create compassion 50
*create integrity 50
*create bravery 50
*create agility 0
*create strength 0
*create intelligence 0
*create charisma 0
*create magic 0
*create gender "unknown"
*create hair "unknown"
*create eyes "unknown"
*label naming
*page_break
What is your name?
*input_text name
*if ("${name}" != "$!{name}")
*goto gender

*label gender
*page_break
What is your gender?
*choice
	#Male
		*set gender "Male"
		*goto hair
	#Female
		*set gender "Female"
		*goto hair
	#Other
		*set gender "Neither/Unknown"
		*goto hair

Is that better? I took out the capitalization, but nothing changed.

Alright, here’s some things I noticed.

  • On your stats screen, you either need to use *stat_chart with the text you’ve written or remove “text” before each item. If you use *stat_chart, you can remove “: ${nameofvariable}” from every item on the list.
  • Your *if that checks the capitalization is empty. You can’t do that. Something has to be underneath the *if.

If you’re checking the stats screen after setting the variables and they’re still displaying “unknown,” then *label gender is getting skipped somewhere else in the code.

1 Like
*label stats_screen
Name: $!{name}
Gender: $!{gender} 
Hair color: $!{hair} 
Eyes: $!{eyes} 

Is this what you mean?

Your stats screen is choicescript_stats.txt, which is opened by clicking the “Show Stats” button in-game. Is that where that specific snippet is located?

1 Like

Yes; everything else is in the startup file.

You have two options on the stats_screen:

  1. *stat_chart
       text Name
       text Gender
       text hair Hair Color
       text Eyes
    
    Reference
  2. Name: $!{name}
    [n/]Gender: $!{gender} 
    [n/]Hair color: $!{hair} 
    [n/]Eyes: $!{eyes}
Both do the same thing. I'd personally recommend the second one, though.

On the other hand:

*label naming
*page_break
What is your name?
*input_text name
*if ("${name}" != "$!{name}")   ///What does this do? As of now, it does nothing.
*goto gender
1 Like

Thank you so much!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.