Twine 2 Sugarcube 2 - Questions about widgets

Twine Version: 2.3.13
Story Format: Sugarcube 2.34.1


I’m working on a project, but I’ve been running into some issues and I’m hoping some more experienced users might be able to help.

So for the past couple days or so, I’ve been testing various things and today I decided to take a whack at Widgets. So basically my widget checks to see what pronouns a player has chosen, and then sets up several temporary variables to show the correct pronouns.

The intent behind this is to create a widget to randomize adjectives and nouns to create variation in my stories text.

Here’s the code.

<<widget "pronoun">>
<<if $pc.pronoun is 0>>
	<<set _proSub to "he">>
	<<set _proObj to "him">>
	<<set _proAdj to "his">>
	<<set _proPos to "his">>
	<<set _proRef to "himself">>
<<elseif $pc.pronoun is 1>>
	<<set _proSub to "she">>
	<<set _proObj to "her">>
	<<set _proAdj to "her">>
	<<set _proPos to "hers">>
	<<set _proRef to "herself">>
	<<set _proSub to "they">>
	<<set _proObj to "them">>
	<<set _proAdj to "their">>
	<<set _proPos to "theirs">>
	<<set _proRef to "themselves">>

So while this works just fine, I’m a bit concerned about a few things.

1): If I use this widget and only one or two of the temporary variables listed above are actually used in the passage, is that going to cause any issues?

2): Is it okay to lump them together like the widget above, or should I be splitting each one into its own widget?

3): Is a widget the best choice for something like this or would a macro or some javascript work better?

I use the excellent Pronouns widget from ChapelR:

It seems to work perfectly and they also have a number of other helpful bits and pieces. I recommend taking a look - you can then either use their code or learn from it when rolling your own.

Have fun!

I wasn’t sure about this at first, but after reading through this and some sample code by HiEv, I think I managed to get something that I’m happy with. Thank you very much for the help.