Need help with character customization code

I really need help with gender variables, because I am a huge noob to COG coding. I can paste my code if you like, but for now I just need an explanation on how to set these things up.

2 Likes

Declare variables with

*create var_a 0   <this is for numerical var>
*create var_b "abc"   <string var>
*create var_c true
*create var_d false   <both these are boolean "on/off">

Modify variables with

*set var_a +1
*set var_a -1
*set var_b "new text"
*set var_c false
etc.

Put these *sets inside your #choice-option


Test your variables with

*if var_a < 5
*if var_b = "Not new text"
*elseif var_c = false
*else

Print your variables with ${var} syntax.

4 Likes

To give a bit more tailored advice, the gender variables you use depend on the genders you plan to offer. Standard afaik is male, female, and non-binary. How you set up variables is entirely dependent on your writing style. Here’s my bare minimum, which comes from an example given to me by another user whose name I can’t remember.

*create g 0
*create plural false

*create he ""
*create him ""
*create his ""
*create himself ""

I use g as a numeric variable for a few reasons. It allows me to have three gender options, and it also makes it easy to use multireplace. For example:

"I just want to spend time with @{g you and the girls|you girls|you and the girls|}," Christine replies.

plural is used to change references when using “they/them” pronouns. For example:

"I think ${he}@{plural 're|'s} the worst," Parker mutters.

he, him, his, and himself are my most common references, so I use string variables and set them when the player decides their gender. I also sometimes use boy and guy. I’ve added the pronouns I replace the strings with depending on gender in the summary. These typically cover everything you’ll ever need.

Summary

Male: he, him, his, himself, boy, guy, boyfriend, husband
Female: she, her, her, herself, girl, gal, girlfriend, wife
Non-binary: they, them, their, themself, kid, person, partner, spouse

You don’t have to name your variables the way I did. I choose to use male pronouns as the variable names because it let’s me consider grammar while I’m writing. My brain doesn’t process true gender-neutral variable names like xe and xim because I don’t really see them as words.

If you’re looking to be more inclusive, you could also let players set their own pronouns by using *input_text for all the pronoun variables. This requires a bit of extra coding but some players appreciate it.

2 Likes

I can share the neopronoun setting code from my WIP, if there’s demand.

1 Like