How to sub in an already-created variable

So, right now I’m trying to set up something where I can choose my haircolor, then a bit later I can choose my beardcolor, but I want to have it so if I pick say, dark red hair, then my beard will be the same as my hair by default. Right now I have:

*set mc_beardcolor {mc_haircolor}

That’s throwing up an error, and I do not know how to fix it. As such, does anyone have a solution that doesn’t have me have to write out every permutation of choices?
Anyway, hope that you all have a good day.

Should be

*set mc_beardcolor "${mc_haircolor}"
1 Like

Thanks. Wasn’t sure if putting it in quotes would just get ${mc_haircolor}, as in that, in the stats page.

If you set it in the same choice, you need to go with

*set mc_beardcolour "color"
*set mc_haircolor "color"

otherwise it won’t show if it’s set in one choice-body

is the command below not enough?

*set mc_beardcolor mc_haircolor

you just want to copy the value in mc_haircolor into mc_beardcolor, right?

then later on the stat page, use ${variable_name} to actually print it out

5 Likes

Valda’s right. In general, if you want var_2 to be the same as var_1, you can just write:

*set var_2 var_1

No need for quotes or curly brackets (until you want to display a variable).

So if you’re setting both in the same choice, you can use MeltingPenguins’s suggested code, but you could also do:

*set mc_haircolor "color"
*set mc_beardcolor mc_haircolor

which will also leave both hair and beard variables set to “color.”

1 Like

Ultimately which method you use boils down to what handle/understand best so it’s easier to fix if need arises. Good luck.

2 Likes

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