His/his is not the same as hers/her - generating correct 3rd person singular for female

In English, male and female 3rd person are not the same.


Subject | Object | Reflexive | Possessive | Determiner
I | me | myself | mine | my
he | him | himself | his | his
she | her | herself | hers | her

I’ve not yet seen any questions or answers on this forum about this topic. I’m providing examples to compare with each other, to make the issue more obvious.

If author means:
Jane ran her car over John’s car, and then John ran his car over Jane! then it should be this:

Jane and John disagreed. She ran her car over his, and then he ran his over her!

If author means: Jane ran her car over John’s car, and then John ran his car over Jane’s car, then it should be this:

Jane and John disagreed. She ran her car over his, and then he ran his over hers.

That small little ‘s’ on the last word of the sentence makes a huge difference. How do I generate the correct possessive/determiners for female gender?

Thank you!


You simply create two his one for poss. and one for deter. and always choose the right one for the text. Or you could initially make all pronounvariables female.

I’ve got some example code here which may be useful, and there’s some discussion in that thread about different ways people handle the grammar.


^ Just create three different variables. ${him} for him/her. ${his} for his/her. ${hers} for his/hers.


I just specifiy the variable where it’s a problem.

For your example:

${herhim} her/him
${herhis} her/his
${hershis} hers/his


I use “they” since all pronouns are different:

they she he
their her his
theirs hers his
them her him
self herself himself

I’m not sure where you looked, but there are many forum threads on the subject. So many that it’s easy to get overwhelmed. I always recommend this one, but there are others, including ones with sample code.


I like your solution the best, @cup_half_empty - thank you!

I’ve written my first game, spread across three files. I’m a programmer first, an author second. I’m finding ChoiceScript is a rudimentary programming language; it reminds me of my first programming language in 1979, Basic. Not Visual Basic. Just Basic.

First, startup.txt:

*comment If you change the list of characters, then remember to change char_num
*create char_name_1   "Dave"
*create char_gender_1 "male"

*create char_name_2   "Lisa"
*create char_gender_2 "female"

*create char_name_3   "Max"
*create char_gender_3 "non-binary"

*create char_name_4   "Lynn"
*create char_gender_4 "female"

*create char_name_5   "Lee"
*create char_gender_5 "non-binary"

*create char_name_6   "Charles"
*create char_gender_6 "male"

*create char_num       6
*create generated_word ""
*comment ********** START **********
*gosub_scene characters 
*goto STOP

*label STOP
[b]Bye-bye! THIS IS THE END![/b]

Second, here what is in characters.txt:

*temp they_ ""
*temp them_ ""
*temp themself_ ""
*temp theirs_ ""
*temp their_ ""
*temp gender ""
*temp end_verb
*temp index 1
[b]There will be ${char_num} characters[/b].
*comment Top of the loop is here:
*label character_loop
*set gender char_gender[index]

*gosub_scene utils gen_3rdperson_sing_word "sub" gender
*set they_ generated_word

*gosub_scene utils gen_3rdperson_sing_word "obj" gender
*set them_ generated_word

*gosub_scene utils gen_3rdperson_sing_word "pos" gender
*set theirs_ generated_word

*gosub_scene utils gen_3rdperson_sing_word "det" gender
*set their_ generated_word

*gosub_scene utils gen_3rdperson_sing_word "ref" gender
*set themself_ generated_word

*set end_verb "s"
*if (gender = "non-binary")
  *set end_verb ""

Character #${index}
$!{char_name[index]} gets up early for work.
Grabbing a hot coffee from the food truck outside ${their_} apartment, ${they_} head${end_verb} into ${their_} job.
"Crap," ${they_} mutter${end_verb} to ${themself_} as ${they_} see${end_verb} the last train pull out of the station.
$!{they_} run${end_verb} for the bus and just barely make${end_verb} it.
At the office, ${their_} boss yells at ${them_} for being late [i]again[/i] and tells ${them_} to clear out ${their_} desk.
Well, at least the coffee is still ${theirs_}.

*set index +1
*if ( index <= char_num )
  *goto character_loop
  *goto after_character_loop
*label after_character_loop

*comment Return from characters subroutine

Finally, here’s what is in utils.txt:

*comment param_1 is type (sub, obj, ref, pos, det)
*comment param_2 is gender (male, female, non-binary)
*comment RETURN VALUE: Unfortunately, subroutines do not seem to be able to return a value
*comment This subroutine assumes the variable
*comment   "generated_word" exists, and puts the return value there.
*comment In other words, this subroutine has a side-effect. Bleck. I prefer functional programming languages.
*label gen_3rdperson_sing_word
*params type temp_gender
*if (temp_gender = "male" )
  *if (type = "sub")
    *set generated_word "he"
  *if(type = "obj")
    *set generated_word "him"
  *if (type = "ref")
    *set generated_word "himself"
  *if (type = "pos") or (type = "det")
    *set generated_word "his"
  *comment If the type is not recognized, use the following as the default
  *set generated_word "he"
*if (temp_gender = "female")
  *if (type = "sub")
    *set generated_word "she"
  *if(type = "obj") or (type = "det")
    *set generated_word "her"
  *if (type = "ref")
    *set generated_word "herself"
  *if (type = "pos")
    *set generated_word "hers"
  *comment If the type is not recognized, use the following as the default
  *set generated_word "she"
*if (temp_gender = "non-binary")
    *comment I'm tempted to use tey, tem, temself, ters, and ter. But these are not in common use at this time.
    *if (type = "sub")
      *set generated_word "they"
    *if(type = "obj")
      *set generated_word "them"
    *if (type = "ref")
      *set generated_word "themself"
    *if (type = "pos")
      *set generated_word "theirs"
    *if (type = "det")
      *set generated_word "their"
    *comment If the type is not recognized, use the following as the default
    *set generated_word "they"
*set generated_word "ERROR"
1 Like

Very organized code :grin:.

Take a look at this project with some ChoiceScript utilities, there may be something there that interests you.

That’s how every programmer I’ve talked to feels about it. The worst part is that abstraction makes a programming language easier, not harder. But CoG is not interested in changing anything about ChoiceScript, even if for the better. It’s a no-win game.

On this note, because ChoiceScript is rudimentary you can’t keep it DRY all the time. I’m not saying it’s the case here, but sometimes it’s better to just copy and paste. :pensive:


I’ve had mixed signals on this. On odd occasions I’ve asked and there’s been a positive/affirmative response (a lot of the compile.html/js code is mine). Sargent also had some merges. I am however 6 months into pinging a patch adding *create_array support (which I don’t feel is a controversial addition!).

Anyway +1 for checking out cslib (even if only to share your thoughts!).


This reminds me a lot of a lot of Gen-Xers I know who look at problems and try to reverse engineer a solution as if people haven’t solved it for quite a while. I think it’s a culture of do-it-yourself-ism when computers were a niche industry requiring even more highly specialised skills and interests than it does today. It demonstrates great initiative, but it’s often a bit frustrating when there’s no need to start developing new solutions. It’s even more frustrating when they start explaining the problem to other people as though nobody has thought of it before.

The best way to avoid coming across like these people is to make your first step looking at how other people have accomplished a solution and work out their reasoning.

If you look at how others write their code, it often looks something like this:

*set they "he"
*set their "his"
*set theirs "his"
*set s "s"

$!{they} drink${s} ${their} coffee. It's ${theirs}.

Which turns into “He drinks his coffee. It’s his.”

And in my current project, I do something a little different, writing my code like this:

@{gender+1 |They drink their coffee. It's theirs.|He drinks his coffee. It's his.|She drinks her coffee. It's hers.}

The biggest advantage of both of these methods is that, compared to yours, they’re simpler, faster, more obvious, and more robust (able to handle more variations much quicker and easier).

Here’s your homework: what are the advantages and disadvantages of the two methods above compared to one another?

Geesh, your disdain is showing a little, brother. No need to be passive agressive.

The multireplace one seems much more tedious than your first one – more typing and duplicate text involved. Are you really using that as standard, or just for verbs that don’t conjugate cleanly with ${s} for “they” pronouns?

I’ll let that question about coding cumbersomeness stand on its own without adding bonus generational aspersions. :slight_smile:


Hi guys. Two things.

First, I just learned CS literally in the past few days, and so I like learning new tips and expect I’ll be learning a lot more.

Second, just a reminder…

Holidays and winter do actually suck for some of us. Thank for all your replies. I’m looking forward to learning more, in a place where kindness is valued by all of us.

Keep it cool.


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