0 votes
by (590 points)

Below is my current code, which defaults to the male pronouns whether "man" or "woman" is selected.

This is a story about a  <<set $gender to ''>><<dropdown '$gender' 'man' 'woman'>>  named  <<textbox '$name' 'Adam' 'Introduction'>><<button Submit 'Introduction'>><</button>>

<<if $gender is 'woman'>><<set $heshe to 'she'>><</if>>
<<if $gender is 'woman'>><<set $capitalheshe to 'She'>><</if>>
<<if $gender is 'woman'>><<set $hisher to 'her'>><</if>>
<<if $gender is 'woman'>><<set $capitalhisher to 'Her'>><</if>>
<<if $gender is 'woman'>><<set $himher to 'her'>><</if>>
<<if $gender is 'woman'>><<set $capitalhimher to 'Her'>><</if>>
<<if $gender is 'woman'>><<set $hishers to 'hers'>><</if>>
<<if $gender is 'woman'>><<set $capitalhishers to 'Hers'>><</if>>
<<if $gender is 'woman'>><<set $himselfherself to 'herself'>><</if>>
<<if $gender is 'woman'>><<set $capitalhimselfherself to 'Herself'>><</if>>
<<if $gender is 'man'>><<set $heshe to 'he'>><</if>>
<<if $gender is 'man'>><<set $capitalheshe to 'He'>><</if>>
<<if $gender is 'man'>><<set $hisher to 'his'>><</if>>
<<if $gender is 'man'>><<set $capitalhisher to 'His'>><</if>>
<<if $gender is 'man'>><<set $himher to 'him'>><</if>>
<<if $gender is 'man'>><<set $capitalhimher to 'Him'>><</if>>
<<if $gender is 'man'>><<set $hishers to 'his'>><</if>>
<<if $gender is 'man'>><<set $capitalhishers to 'His'>><</if>>
<<if $gender is 'man'>><<set $himselfherself to 'himself'>><</if>>
<<if $gender is 'man'>><<set $capitalhimselfherself to 'Himself'>><</if>>

 

Below is an example of how these statements are utilised.

<div class="typed-speed30-delay700">$name was a train driver.

What $name did was relatively simple. $capitalheshe would wait for orders to come through from Head Office telling him where to go, and then $heshe would carry them out with swift efficiency.

$name did this day in, day out. 
<<timed 5s>><</timed>>
In $name's mind, life couldn't be better.</div>

<<timed 21s>><<goto "Introduction2">><</timed>>

 

I have also tried to use <<if>><<else>> elements but it still defaults to male pronouns. See below.

<<if $gender is "man">><<set $heshe to "he">><<else>><<set $heshe to "she">><</if>>
<<if $gender is "man">><<set $capitalheshe to "He">><<else>><<set $capitalheshe to "She">><</if>>
<<if $gender is "man">><<set $hisher to "his">><<else>><<set $hisher to "her">><</if>>
<<if $gender is "man">><<set $capitalhisher to "His">><<else>><<set $capitalhisher to "Her">><</if>>
<<if $gender is "man">><<set $himher to "him">><<else>><<set $himher to "her">><</if>>
<<if $gender is "man">><<set $capitalhimher to "Him">><<else>><<set $capitalhimher to "Her">><</if>>
<<if $gender is "man">><<set $hishers to "his">><<else>><<set $hishers to "hers">><</if>>
<<if $gender is "man">><<set $capitalhishers to "His">><<else>><<set $capitalhishers to "Hers">><</if>>
<<if $gender is "man">><<set $himselfherself to "himself">><<else>><<set $himselfherself to "herself">><</if>>
<<if $gender is "man">><<set $capitalhimselfherself to "Himself">><<else>><<set $capitalhimselfherself to "Herself">><</if>>

 

And finally, I have tried removing all male relevant if-statements in the initial passage - which leads all proceeding passages to just display the values as $capitalheshe or $hisher, etc.

If anybody could help me identify what is wrong or suggest a fix, I'd be incredibly grateful, thanks!

2 Answers

+1 vote
by (159k points)
selected by
 
Best answer

NOTE: Because you forgot to state which <<dropdown>> macro you are using, and because I needed one to be able to test your examples I decided to use the one from this answer.

Try the following as a replacement for your first example.

<<set $gender to '', $name to ''>>\
This is a story about a <<dropdown '$gender' 'man' 'woman'>>\
 named <<textbox '$name' 'Adam' 'Introduction'>>\
<<button 'Submit' 'Introduction'>>
	<<if $gender is 'woman'>>
		<<set $heshe to 'she'>>
		<<set $capitalheshe to 'She'>>
		<<set $hisher to 'her'>>
		<<set $capitalhisher to 'Her'>>
		<<set $himher to 'her'>>
		<<set $capitalhimher to 'Her'>>
		<<set $hishers to 'hers'>>
		<<set $capitalhishers to 'Hers'>>
		<<set $himselfherself to 'herself'>>
		<<set $capitalhimselfherself to 'Herself'>>
	<<else>>
		<<set $heshe to 'he'>>
		<<set $capitalheshe to 'He'>>
		<<set $hisher to 'his'>>
		<<set $capitalhisher to 'His'>>
		<<set $himher to 'him'>>
		<<set $capitalhimher to 'Him'>>
		<<set $hishers to 'his'>>
		<<set $capitalhishers to 'His'>>
		<<set $himselfherself to 'himself'>>
		<<set $capitalhimselfherself to 'Himself'>>
	<</if>>
<</button>>

... there were a number of issues with your original first example:

1. You weren't initialising the $name variable, and ideally both the $gender and $name variables should be initialised within your StoryInit special passage.

2. The Label parameter of your <<button>> macro should be a String value, so it needs to be wrapped in quotes.

3. Your <<if>> macros were being executed when the Passage was first shown, and not when the Submit button was pressed. This means that the referenced $gender variable was equal to an empty String, which is why none of the related <<set>> macros were being executed.

4. You don't need to check the $gender variable for each of the related <<set>> macros, you can check it a single time then execute multiple <<set>> macros within the relevant <<if>> or <<else>> macro's body.

In relation to your second example, your first <<timed>> macro call isn't doing anything, and I'm not totally sure what you wanted it to do so I haven't made a suggests on how to fix it.

+1 vote
by (2.2k points)

While this seem to work, I choose another solution in my games.

I created two macros to tackle grammar gender problems (they are much more noticeable in my native language). You can copy full code from my repo and paste it to Story JavaScript, and use them like this:

<!-- 
Usually appears at the beginning of the story. This displays link that upon clicking will switch between Mary and John and change $isFemale value. 
First string is for female version and second is for male version.
-->
My name is <<genderswitch $isFemale "Mary" "John">> Watson. 

<!-- 
Used throughout the story where needed. 
If used on the same passage as <<genderswitch>> will be updated on the fly. 
Again, first value is for female version and second is for male one.
-->
My father says: My dear <<gender "daughter" "son">>! 

It is recommended to explicitly set $isFemale either to true or false in StoryInit special passage.

...