Twine Version: 2.3.9
Story Format: SugarCube 2.31.1
Hi, I’m making my first ever game and have a question.
I’m working on an IF story/game with a set group of characters that the player interacts with to solve mysteries/learn stuff/etc. The stories of those characters do not change, but one thing that is randomized per Story are their pronouns.
The code I’ve written functions as intended, but it feels like I’m doing just a metric ton of copying and pasting and I know in the back of my mind that there’s gotta be a cleaner way to do it and will likely help make me write more efficiently in the long run.
Currently, I have in StoryInit this character initialization for everyone:
/* The Star */
<<set $Star = {
fullname: ...,
firstname: ...,
lastname: ...,
pronouns: either ("hehim", "sheher", "theythem", "theyshe", "theyhe"),
}>>\
<<StarPronouns>>
/* The Captain */
<<set $Captain = {
fullname: ...,
firstname: ...,
lastname: ...,
pronouns: either ("hehim", "sheher", "theythem", "theyshe", "theyhe"),
}>>\
<<CaptainPronouns>>
And then, in the Pronouns Widget passage, I have this for each character:
/* The Star */
<<widget "StarPronouns">>\
<<nobr>>\
<<if $Star.pronouns is "hehim">>\
<<set $Star.they to "he">>\
<<set $Star.them to "him">>\
<<set $Star.their to "his">>\
<<set $Star.theirs to "his">>\
<<set $Star.theyre to "he's">>\
<<elseif $Star.pronouns is "sheher">>\
<<set $Star.they to "she">>\
<<set $Star.them to "her">>\
<<set $Star.their to "hers">>\
<<set $Star.theirs to "hers">>\
<<set $Star.theyre to "she's">>\
<<elseif $Star.pronouns is "theythem">>\
<<set $Star.they to "they">>\
<<set $Star.them to "them">>\
<<set $Star.their to "their">>\
<<set $Star.theirs to "theirs">>\
<<set $Star.theyre to "they're">>\
<<elseif $Star.pronouns is "theyshe">>\
<<set $Star.they to either ("they", "she")>>\
<<set $Star.them to either ("them", "her")>>\
<<set $Star.their to either ("their", "hers")>>\
<<set $Star.theirs to either ("theirs", "hers")>>\
<<set $Star.theyre to either ("they're", "she's")>>\
<<elseif $Star.pronouns is "theyhe">>\
<<set $Star.they to either ("they", "he")>>\
<<set $Star.them to either ("them", "him")>>\
<<set $Star.their to either ("their", "his")>>\
<<set $Star.theirs to either ("theirs", "his")>>\
<<set $Star.theyre to either ("they're", "he's")>>\
<</if>>
<</nobr>>
<</widget>>
/* Captain */
<<widget "CaptainPronouns">>\
<<nobr>>\
<<if $Captain.pronouns is "hehim">>\
<<set $Captain.they to "he">>\
<<set $Captain.them to "him">>\
<<set $Captain.their to "his">>\
<<set $Captain.theirs to "his">>\
<<set $Captain.theyre to "he's">>\
<<elseif $Captain.pronouns is "sheher">>\
<<set $Captain.they to "she">>\
<<set $Captain.them to "her">>\
<<set $Captain.their to "hers">>\
<<set $Captain.theirs to "hers">>\
<<set $Captain.theyre to "she's">>\
<<elseif $Captain.pronouns is "theythem">>\
<<set $Captain.they to "they">>\
<<set $Captain.them to "them">>\
<<set $Captain.their to "their">>\
<<set $Captain.theirs to "theirs">>\
<<set $Captain.theyre to "they're">>\
<<elseif $Captain.pronouns is "theyshe">>\
<<set $Captain.they to either ("they", "she")>>\
<<set $Captain.them to either ("them", "her")>>\
<<set $Captain.their to either ("their", "hers")>>\
<<set $Captain.theirs to either ("theirs", "hers")>>\
<<set $Captain.theyre to either ("they're", "she's")>>\
<<elseif $Captain.pronouns is "theyhe">>\
<<set $Captain.they to either ("they", "he")>>\
<<set $Captain.them to either ("them", "him")>>\
<<set $Captain.their to either ("their", "his")>>\
<<set $Captain.theirs to either ("theirs", "his")>>\
<<set $Captain.theyre to either ("they're", "he's")>>\
<</if>>
<</nobr>>
<</widget>>
etc.
etc.
(Yes, I know there are a lot of escapes, I got frustrated trying to find what was doing it and just took the nuclear option. Feel free to show me how to clean that up as well.)
Anyway, it’s outputting how I want, but I feel like it’s working twice as hard to do half as much? The usage is to do something like this:
$Captain.firstname shrugs at the question, fiddling with $Captain.their microphone. "I don't know. You'll have to ask $Star.them."
(I’m also having an issue with “they are” vs. “he is” verbs, not really liking what solutions I’ve seen thus far, but I think this topic is getting bloated as is.)
Any help to tighten this up would be much appreciated.