Efficient solution for managing pronouns + easy support for custom pronouns

I was trying to find an efficient solution for managing pronouns for a number of characters in the game I’m working on and have decided to share my array-based solution.

The problem

If you have multiple gender selectable characters (including the player), you will end up declaring multiple variables to store each pronoun for each character: player_he, plater_his, npc_he, npc_his, npc2_he, npc2_his, etc. Which you will set in various parts of the game with things like:

*set player_he "he"
...
*set npc_he "she"
...
*set npc2_he "they"

This can become cumbersome and error-prone.

Solution

This solution assumes that you understand how to use arrays and have the latest version of ChoiseScript or CSIDE that has the *create_array command:

New in ChoiceScript: *create_array, *temp_array commands, *page_break_advertisement

This code is based on the Pronouns sample project from CSIDE written by Lynnea Glasser.

  1. Inside the startup file are going to declare a constant value for each gender we want to support:
*comment gender constants
*create kMale 1
*create kFemale 2
*create kNb 3
  1. We are going to create and initialize an array for each pronoun type
*comment pronoun arrays
*create_array he 3 "he" "she" "they"
*create_array him 3 "him" "her" "them"
*create_array his 3 "his" "her" "their"
*create_array hiss 3 "his" "hers" "theirs"
*create_array himself 3 "himself" "herself" "themself"
*comment This is for the 's' on the ends of verbs, as in "they walk"/"she walks".
*create_array s 3 "s" "s" ""
*comment This is for the 'es' on the ends of verbs, as in "they march"/"she marches".
*create_array es 3 "es" "es" ""
*comment These two are for contractions. Note that all versions of them have an apostrophe: "they're"/"she's".
*create_array re 3 "s" "s" "re"
*create_array ve 3 "s" "s" "ve"
*comment This variable can be used in case there are any irregular verbs, as in "they are" / "she is".
*create_array them 3 false false true
*comment boy/girl/child
*create_array boy 3 "boy" "girl" "child"
*comment man/woman/person
*create_array man 3 "man" "woman" "person"
*comment Mr./Miss/M*
*create_array title 3 "Mr." "Mrs." "M*"
  1. Declare variables for all your characters with selectable genders
*create playerGender 0
*create npcGender 0
  1. Set a character’s gender
Choose your gender
*fake_choice
    # Male
         *set playerGender kMale
    # Female
         *set playerGender kFemale
    # Nonbinary
         *set playerGender kNb
  1. Test it out

$!{he[playerGender]}${re[playerGender]} beaming widely as ${he[playerGender]} bow${s[playerGender]} and gracefully offer${s[playerGender]} you ${his[playerGender]} hand. You take it. You're lucky to have ${him[playerGender]} by your side.

How do I modify the solution to add custom pronouns?
  1. Add an extra gender constant in ascending order from the last constant (kNb was 3 and last)

*create kZer 4

  1. Modify the array pronoun sizes from 3 to 4 and add the 4th pronoun
*create_array he 4 "he" "she" "ze"
*create_array him 4 "him" "her" "zim"
...

And from here you can test it out like in the solution example, the only thing you have to change is to set the player gender to kZer. You can also let the player input their own pronouns with things like:

What is your he/she pronoun?
*input_text he[kZer]

With this approach, when you need to add a new character with a selectable gender, all you have to do is declare their gender variable, set it somewhere, then pick a pronoun when you need it from the array using their set gender index.

- in startup file
*create npc1_gender 0
*create npc2_gender 0

-in a game file somewhere
*set npc1_gender kFemale
*set npc2_gender kMale

-in game text somewhere
$!{he[npc1_gender]} clutched ${his[npc1_gender]} pearls witnessing the awesome power of arrays. $!{his[npc2_gender]} face melted shortly after.
8 Likes

This looks like a very clean and comprehensive way of dealing with all the gender variables. I will be sure to revisit this page if I ever end up having to created a bunch of gender-selectable npcs. Thank you so much for sharing!

2 Likes

That’s no worse than I’ve seen most authors handle it!

But I sincerely encourage every aspiring choicescript writer to do some code diving into games that have features you want to use. I feel like each author handles issues like pronoun-verb agreement differently and you might find one that inspires you.

I think the most elegant solution I’ve seen is to refer to the PC as little as possible, and phrasing the whispered hearsay or whatever as flexibly as you can.

“[player_name] is amazing! I hear [pronoun_1] killed a warthog with [pronoun_3] bare hands! All while singing a merry song!” works for he/she/they/etc and his/her/their/etc without any verb modifications.

Whereas “[player_name] is amazing! I hear that [pronoun_1] [has/have] killed a warthog with [pronoun_3] bare hands while [pronoun_1] [was/were] singing a merry song!” clearly needs an extra coding step to handle verb agreement.

Very subtle differences in sentence structure can lead to much easier coding, and made all the easier by only refering to the PC a scant number of times.

3 Likes

The posted solution is a bit overkill if you need to handle only the MC pronouns. It’s more geared towards projects that have multiple NPCs with selectable genders. This way, you write all the pronouns once for each character and keep only one variable per character to track their gender.

Obviously, it’s better to reduce the use of pronouns, but if you need to use them even once, then you will need a variable for them.

1 Like