Sample Code for Multiple Pronouns ("She/They", "He/They", Etc) for Player Characters

I’m curious if other games have an easy/efficient method for allowing the player character to use multiple sets of pronouns (for example, “he/they”, “she/they”, etc). Below, I’ll share a method I came up with that I’ll most likely end up using in my game.

EDIT: I made some sample code that everyone is free to use in their own games, and/or modify in whatever ways they find useful. View it here.

This is the code I started with for establishing pronouns (using @HarrisPS’s excellent pronoun sample code):

*label pc_she

*set pc_he “she”
*set pc_him “her”
*set pc_his “her”
*set pc_singular true

*return

And in the game’s text:

“Of course ${pc_he} do@{pc_singular es|}. I can even get ${pc_him} in for free.”

This produces:

“Of course she does. I can even get her in for free.”

To change Hannah’s code to allow for multiple pronouns, I added a second set of pronoun variables, and just kept the second set the same as the first set for players who only use one pronoun.

So if pronouns are she/her:

*label pc_she

*set pc_he “she”
*set pc_him “her”
*set pc_his “her”
*set pc_singular true
*set pc_he2 “she”
*set pc_him2 “her”
*set pc_his2 “her”
*set pc_singular2 true

*return

Both sets are set to she/her.

And if pronouns are she/they:

*label pc_she_they

*set pc_he “she”
*set pc_him “her”
*set pc_his “her”
*set pc_singular true
*set pc_he2 “they”
*set pc_him2 “them”
*set pc_his2 “their”
*set pc_singular2 false

*return

The first set is set to she/her and the second is set to they/them.

And then in the game’s text:

“Of course ${pc_he2} do@{pc_singular2 es|}. I can even get ${pc_him} in for free.”

This would produce for she/her:

“Of course she does. I can even get her in for free.”

And for she/they:

“Of course they do. I can even get her in for free.”

Without having to write the same line in the game’s text twice.

I initially thought, because I have pronouns set up using multireplace, that I’d need to type out a second version of some sentences where multiple pronouns would occur (because you can’t nest multireplaces inside one another), but creating a second set of pronoun variables for everyone eliminates this problem. You just keep the second pronoun set identical to the first one for single-pronoun Player Characters.

Anyway, once I’ve implemented this in my game I’ll probably put a little sample on dashingdon for people to use in their games too & update this post with a link. (Assuming it works well, and no one else has a better/more efficient way of doing this! I’d love to hear from anyone else who has addressed this in their game, or knows of games that allow for multiple pronoun sets!)

Thanks for reading :slightly_smiling_face:

17 Likes

There is probably also a way you can randomly select between 1 and 2, so that you don’t run the risk of unbalanced usage.

1 Like

Probably the simplest version that I’ve come across. I don’t remember which game I found it in.

*if (gender = "female")
    *set gender_him "her"
    *set gender_his "her"
    *set gender_he "she"
*if (gender = "male")
    *set gender_him "him"
    *set gender_his "his"
    *set gender_he "he"
*if (gender = "Non-Binary")
    *set gender_him "them"
    *set gender_his "their"
    *set gender_he "they"
1 Like

You’d need a lot more code to get that to accept two pronoun sets.

I didn’t make this clear enough, I was just trying to point out a way to simplify it so you don’t have to make so many labels for every combination. You can have all the code within one label.

I could be wrong since I’m not a programmer, but I actually think that would end up with more code overall, since you’d need labels for every single combination rather than just two sets of labels.

You would just need to double the amount of code and set pc_singular to true or false for the multi-replace, instead of creating a *label pc_she_they or other combinations that are suggested above.

For example:

For this, you’d have to make another label for pc_him_they, and two more for the rest. Or you can condense it all into less than thirty lines of code.

1 Like

I think I’m still not understanding how you get from if statements that aren’t in labels at all to a small set of labels.

Actually, why are we even using labels? Shouldn’t we be using variables?

What I’m suggesting is that we condense all of the variables into one label instead of several, if I am understanding what was suggested above. The variables for the gender of the player are already set by the time we get to the pronouns. *gosub would go to the correct labels for the suggested example.

*label pc_she
*set pc_he “she”
*set pc_him “her”
*set pc_his “her”
*set pc_singular true
*set pc_he2 “she”
*set pc_him2 “her”
*set pc_his2 “her”
*set pc_singular2 true

*return

*label pc_she_they
*set pc_he “she”
*set pc_him “her”
*set pc_his “her”
*set pc_singular true
*set pc_he2 “they”
*set pc_him2 “them”
*set pc_his2 “their”
*set pc_singular2 false

*return

As shown before, they need to type the same variables into each label. However, we can put all of them into one label, or use *fake_choice to skip *gosub.

*if gender = "female"
    *set gender_him "her"
    *set gender_his "her"
    *set gender_he "she"
*if gender = "male"
    *set gender_him "him"
    *set gender_his "his"
    *set gender_he "he"
*if gender = "non-binary"
    *set gender_him "them"
    *set gender_his "their"
    *set gender_he "they"
*if gender2 = "female"
    *set gender2_him "her"
    *set gender2_his "her"
    *set gender2_he "she"
*if gender2 = "male"
    *set gender2_him "him"
    *set gender2_his "his"
    *set gender2_he "he"
*if gender2 = "non-binary"
    *set gender2_him "them"
    *set gender2_his "their"
    *set gender2_he "they"
1 Like

Oh, so you’re saying that the labels should set gender rather than set pronouns, and then afterwards you can use if statements to determine pronouns from the gender. I was thinking you were trying to replace the entire thing with just these gender-sets, which wouldn’t work because they wouldn’t be referenced anywhere.

Are you talking about labels or the command *label? You might also be confused by how I named my variables to set pronouns.

Wait, is there a difference? I just assumed we were talking about the command *label.

@Phantmwolf thank you for your suggestions & code! I’m planning on keeping gender and pronoun selection as separate choices for maximum customization on the player’s end, but perhaps I can still organize things a bit more efficiently.

I’ve found this variable naming scheme doesn’t disambiguate enough; “his” could be the possessive pronoun:

The box is his.

or the possessive adjective:

That’s his box.

Similarly, naming them with female pronouns doesn’t work, either; “her” can be the object pronoun:

Look at her.

or the possessive adjective:

Look into her eyes.

Flipping the genders should result in:

The box is hers.
That’s her box.
Look at him.
Look into his eyes.

But it can’t do that if each of those pairs is named “his”, or each is named “her”.

Instead, I find it best to use the third person plural for variable names; that avoids all ambiguity.

The system I use in RD is to define a few genders as numbers, to make @multireplace and array indexing easy:

*create FEMALE 1
*create MALE 2
*create THEMS 3

(I also ended up with plural, object/thing, and second-person, but you probably should start off keeping things simple.)

Then I defined a whole list of variable replacements using those array indices:

*create they_1 "she"
*create they_2 "he"
*create they_3 "they"

*create them_1 "her"
*create them_2 "him"
*create them_3 "them"

*create themselves_1 "herself"
*create themselves_2 "himself"
*create themselves_3 "themself"

*create their_1 "her"
*create their_2 "his"
*create their_3 "their"

*create theirs_1 "hers"
*create theirs_2 "his"
*create theirs_3 "theirs"

*comment for verb endings
*create s_1 "s"
*create s_2 "s"
*create s_3 ""

and so on.

After that, it’s just a matter of defining everyone with a gender:

*set x_sam MALE

*fake_choice
   #Male.
      *set x_player MALE
   #Female.
      *set x_player FEMALE
   #Non-binary.
      *set x_player THEMS

And then using these in text is as simple as writing the variable name using that as its index:

“Yes,” Sam says. $!{They[x_sam]} nod${s[x_sam]}. “Just look at ${them[x_player]}!”

That way you don’t need to keep track of who you’re referring to and alter it on the fly. I used your system in Machinations, and it caused tons of headaches and bugs. This array method seems much less likely to cause problems, that I’ve noticed, because whatever gender is assigned to each character is inherent to them and generally never changes during play.

1 Like

And now that we have *create_array, we should be able to make the initialization in startup.txt even more compact:

*create_array they 3 "she" "he" "they"
*create_array them 3 "her" "him" "them"
*create_array themselves 3 "herself" "himself" "themselves"
*create_array their 3 "her" "his" "their"
*create_array theirs 3 "hers" "his" "theirs"
*create_array are 3 "is" "is" "are"

*comment for verb endings:
*create_array s 3 "s" "s" ""
*create_array es 3 "es" "es" ""
1 Like

I wasn’t trying to make a working version. My main goal was to show how its possible to condense the code using a similar method the thread poster was using.

Thanks everybody for all your suggestions! I’ve been having some health issues recently, and my fuzzy brain had a difficult time wrapping around all of your suggestions, but I did make some sample code that works. Feel free to use or modify in whatever ways are useful to you, and thanks again for all your comments and suggestions.

1 Like