0 votes
by (160 points)
Hi there!

At the start of my game, I let the player select either a male or female character, which will effect the story at certain points.

Rather than writing out identical passages for sections which aren't effected by this gender choice, I want to be able to check back to their initial choice when necessary so I can give them a link to only the male or female passage, depending on their initial choice.

How do I do this?

Thanks!

1 Answer

0 votes
by (160 points)

I think I might have worked this out myself, but will leave open in case someone tells me there's a better way to do it.

For each of the passages where your gender is added I added (respectfully):

<<set $isMale to true>>

<<set $isFemale to true>>

Then, whenever the story branches depending on gender I'm adding:

<<if $isMale is true>>
[[Passage Name]]
<<else>>
[[Passage Name]] 
<</if>>

Is this going to cause me any issues when I add more and more branches, or can I just use this simple bit of code on each occassion? 

by (44.7k points)

Yup, that's typically how it's done.

That said, if your game is gender-binary (only male or female), then you don't need to track both $isMale and also $isFemale, since if one is true then the other is automatically false.  You can also just do <<if $isMale>> (to determine if the player is male) or <<if not $isMale>> (to determine if the player is female), and the <<else>> case will be the opposite.

If you're interested, you can also use my <<SetPronouns>> widget to make writing properly gendered pronouns easier.  (Click "Jump to Start" in the UI bar to see other sample code there.)

Hope that helps!  :-)

by (160 points)
Perfect, thanks! I'll be sure to check out your widget.
by (44.7k points)

FYI, the link I gave you uses DriveToWeb to display stuff from my Google Drive account, and DriveToWeb appears to be down at the moment.  Hopefully it should be back up soon, but here's the Twine/SugarCube source to the passage I was trying to direct you to:

<h2>{{{<<SetPronouns>>}}} Widget</h2>This widget makes it fairly easy to write text which automatically displays gendered pronouns correctly based on the gender you set.

For example, you could write this text:
{{{
* $They got $themself a new toy for $their collection and $theyre very happy about it.
}}}

And if you had previously done {{{<<SetPronouns "f">>}}}, then that text would display as:<<SetPronouns "f">>
* $They got $themself a new toy for $their collection and $theyre very happy about it.

Alternately, {{{<<SetPronouns>>}}} would give you:<<SetPronouns>>
* $They got $themself a new toy for $their collection and $theyre very happy about it.

And {{{<<SetPronouns "n">>}}} would give you:<<SetPronouns "n">>
* $They got $themself a new toy for $their collection and $theyre very happy about it.

{{{<<SetPronouns "b">>}}} would give you:<<SetPronouns "b">>
* $They got $themself a new toy for $their collection and $theyre very happy about it.

Note that the variables are case sensitive, so (uppercase) {{{$They}}} shows as "$They" and (lowercase) {{{$they}}} shows as "$they".  Also, you have to use {{{$Theyre}}} and {{{$theyre}}}, because variables can't have an apostrophe in their name.

To use this, add the following code to a passage with a "widget" tag:
{{{
<<widget "SetPronouns">><<nobr>>
/* Usage... (defaults to male) */
/* for "he":   <<SetPronouns>> */
/* for "she":  <<SetPronouns "f">> */
/* for "they": <<SetPronouns "b">> */
/* for "it":   <<SetPronouns "n">>*/
	<<switch $args[0]>>
		<<case "f">>
			<<set $they = "she">>
			<<set $them = "her">>
			<<set $themself = "herself">>
			<<set $themselves = "themselves">>
			<<set $their = "her">>
			<<set $theirs = "hers">>
			<<set $theyre = "she's">>
			<<set $youngPerson = "girl">>
			<<set $youngPeople = "girls">>
			<<set $adultPerson = "woman">>
			<<set $adultPeople = "women">>
			<<set $generalPerson = "girl">>
			<<set $generalPeople = "girls">>
			<<set $pal = "chick">>
			<<set $pals = "chicks">>
			<<set $They = "She">>
			<<set $Them = "Her">>
			<<set $Themself = "Herself">>
			<<set $Themselves = "Themselves">>
			<<set $Their = "Her">>
			<<set $Theirs = "Hers">>
			<<set $Theyre = "She's">>
			<<set $YoungPerson = "Girl">>
			<<set $YoungPeople = "Girls">>
			<<set $AdultPerson = "Woman">>
			<<set $AdultPeople = "Women">>
			<<set $GeneralPerson = "Girl">>
			<<set $GeneralPeople = "Girls">>
			<<set $Pal = "Chick">>
			<<set $Pals = "Chicks">>
		<<case "b">>
			<<set $they = "they">>
			<<set $them = "them">>
			<<set $themself = "themselves">>
			<<set $themselves = "themselves">>
			<<set $their = "their">>
			<<set $theirs = "theirs">>
			<<set $theyre = "they're">>
			<<set $youngPerson = "person">>
			<<set $youngPeople = "people">>
			<<set $adultPerson = "person">>
			<<set $adultPeople = "people">>
			<<set $generalPerson = "guy">>
			<<set $generalPeople = "guys">>
			<<set $pal = "pal">>
			<<set $pals = "pals">>
			<<set $They = "They">>
			<<set $Them = "Them">>
			<<set $Themself = "Themself">>
			<<set $Themselves = "Themselves">>
			<<set $Their = "Their">>
			<<set $Theirs = "Theirs">>
			<<set $Theyre = "They're">>
			<<set $YoungPerson = "Person">>
			<<set $YoungPeople = "People">>
			<<set $AdultPerson = "Person">>
			<<set $AdultPeople = "People">>
			<<set $GeneralPerson = "Guy">>
			<<set $GeneralPeople = "Guys">>
			<<set $Pal = "Pal">>
			<<set $Pals = "Pals">>
		<<case "n">>
			<<set $they = "it">>
			<<set $them = "it">>
			<<set $themself = "itself">>
			<<set $themselves = "themselves">>
			<<set $their = "its">>
			<<set $theirs = "its">>
			<<set $theyre = "it's">>
			<<set $youngPerson = "person">>
			<<set $youngPeople = "people">>
			<<set $adultPerson = "person">>
			<<set $adultPeople = "people">>
			<<set $generalPerson = "guy">>
			<<set $generalPeople = "guys">>
			<<set $pal = "pal">>
			<<set $pals = "pals">>
			<<set $They = "It">>
			<<set $Them = "It">>
			<<set $Themself = "Itself">>
			<<set $Themselves = "Themselves">>
			<<set $Their = "Its">>
			<<set $Theirs = "Its">>
			<<set $Theyre = "It's">>
			<<set $YoungPerson = "Person">>
			<<set $YoungPeople = "People">>
			<<set $AdultPerson = "Person">>
			<<set $AdultPeople = "People">>
			<<set $GeneralPerson = "Guy">>
			<<set $GeneralPeople = "Guys">>
			<<set $Pal = "Pal">>
			<<set $Pals = "Pals">>
		<<default>>
			<<set $they = "he">>
			<<set $them = "him">>
			<<set $themself = "himself">>
			<<set $themselves = "themselves">>
			<<set $their = "his">>
			<<set $theirs = "his">>
			<<set $theyre = "he's">>
			<<set $youngPerson = "boy">>
			<<set $youngPeople = "boys">>
			<<set $adultPerson = "man">>
			<<set $adultPeople = "men">>
			<<set $generalPerson = "guy">>
			<<set $generalPeople = "guys">>
			<<set $pal = "dude">>
			<<set $pals = "dudes">>
			<<set $They = "He">>
			<<set $Them = "Him">>
			<<set $Themself = "Himself">>
			<<set $Themselves = "Themselves">>
			<<set $Their = "His">>
			<<set $Theirs = "His">>
			<<set $Theyre = "He's">>
			<<set $YoungPerson = "Boy">>
			<<set $YoungPeople = "Boys">>
			<<set $AdultPerson = "Man">>
			<<set $AdultPeople = "Men">>
			<<set $GeneralPerson = "Guy">>
			<<set $GeneralPeople = "Guys">>
			<<set $Pal = "Dude">>
			<<set $Pals = "Dudes">>
	<</switch>>
<</nobr>><</widget>>
}}}
Then set the pronouns appropriately by calling the widget when the gender is chosen, and after that you just use the pronoun variables listed above in your text.

(Note: You'll also need to copy the section of widget code to a passage with a "widget" tag for that passage to display properly.)

...