Adding gender and romance variables

Twine Version: 2.3.16 (Browser)
Story Format: SugarCube 2.36.1

I’ve decided to make another game, this time somewhat inspired by a franchise I’ve loved since I was a kid. Nintendo’s “Legend of Zelda” franchise is what I wanted to use. In the story, the player is prompted to create a Hylian for themself. They create the character and it is used in the story. I’m thinking about adding a customizable name for the player, though I don’t think I want that yet. I just want to get this first part done. Moving on, I want to give an option for the player to choose from being male, female and non-binary. After that, I want them to be given the option for their romantic preference. Male, female, no preference or aromantic (no romance at all). I’d like for it to be similar to an adventure game, kind of like the player exploring the world and seeing what they want to do. I’d like to add sidequests, like many Zelda games have, though I’m not entirely sure on how to do so. I’m thinking about doing a listbox this time, rather than what I did before (I created a different game, the main character chooses from liking guys or girls or no one after choosing their gender in separate passages). I used another user’s question to start, that being the “How do I do romance options” article for it, but I’m not sure what to do after. I used souppilouliouma’s code that looked like this:
<label><<radiobutton "$gender" "male" autocheck>> I'm a man!</label> <label><<radiobutton "$gender" "female">> I'm a woman!</label> <label><<radiobutton "$gender" "fluid">> I'm genderfluid!</label> <label><<radiobutton "$gender" "nonbinary">> Dude, your questions are somewhat obsolete, don't you think?</label>
for the gender and their code for romantic preference, as well, that being this:

<label><<radiobutton "$romantic_preference" "men" autocheck>> I'm attracted to men!</label>
<label><<radiobutton "$romantic_preference" "women">> I'm attracted to women!</label>
<label><<radiobutton "$romantic_preference" "no preference">> I'm attracted to both!</label>
<label><<radiobutton "$romantic_preference" "asexual">> I'm attracted to neither!</label>

I’m not sure why the article isn’t working for my project, I’m using the same model of SugarCube (I think?) and I put in the same code. Is there something I’m missing? Like a different format? Thank you for any help I receive, I may just be being dumb but I want to make sure I get this done.

Isn’t working in what way? Can you be more specific about what you’re doing that isn’t working?

The code looks fine (other than having “autocheck” instead of “checked”), so just saying it “isn’t working” doesn’t really give us much to go on here.

It isn’t working in that I created a new project, chose the “SugarCube 2.36.1” format, created a passage by default and put in text commands that aren’t registering. So far in my code, I have:

Here begins your journey. You will now be able to customize your own Hylian.

What is your gender?
<label><<radiobutton "$gender" "male" autocheck>> I'm a man!</label>
<label><<radiobutton "$gender" "female">> I'm a woman!</label>
<label><<radiobutton "$gender" "nonbinary">> I'm nonbinary!</label>

However, what I want to do it lead each choice to another passage, choosing the romantic preference. But I’ve added the code and it doesn’t create three other passages for the character. Rather, it stays in the same passage. I added in more code, the one for the romantic preference that I mentioned in my previous post. Though I did this, it creates a page that looks like similar to:

Here begins your journey. You will now be able to customize your own Hylian.

What is your gender?

*  I'm a man!
*  I'm a woman!
*  I'm nonbinary!

What is your romantic preference?

*  I'm attracted to men!
*  I'm attracted to women!
*  I'm attracted to both!
*  I'm attracted to neither!

This leads to the player clicking on the options and staying in the same passage. I’d like to know, is there a way to create a passage with just those choices alone? As in, the player chooses their gender and their romantic preference, then brings them to the next passage saying, "So you are a [man, woman, or non-binary person] that is attracted to [men, women, both men and women, or no one]?", but I’m not sure how to create and add the code for those commands into my project. I’d like help in figuring out how to create a passage that has the player asked if their choices match their desire, and, if not, bringing it to the selection passage again. Something like:

So you are a [man, woman, or non-binary person] that is attracted to [men, women, both men and women, or no one]?

* Yes, I am [This brings them to the next passage, starting the storyline]
* No, I am not [This brings them back to the selection page, letting them choose again]

Is there a way to do that? Thank you for helping me with this in any way that you can, if I need to clarify further, I will. It may be that I’m using the <<radiobutton>> macro, though I’m not entirely sure. I may look at previous posts to see if there’s something I’m missing, but I would like someone’s input.

Thank you. :]

First, as I mentioned before, you should change “autocheck” to “checked”, since that will make it so that the “checked” radio button(s) will be selected by default.

Second, after those choices you should have a link that takes them to the next passage where you do things based on those choices. To do that, just add a [[Confirm]] link, or something like that, at the end of the passage. Then, in the “Confirm” passage, you can display whatever you want, depending upon the player’s choices, such as this:

So you are a $gender that is attracted to \
<<switch $romantic_preference>>\
	<<case "no preference">>\
		both men and women?
	<<case "asexual">>\
		no one?
	<<default>>\
		$romantic_preference?
<</switch>>
* [[Yes, I am.|Next passage name]]
* <<back "No, I am not.">>

I didn’t test it, but I think that should do what you’re asking for, just make sure that you replace “Next passage name” with whatever name the next passage has. See the <<switch>> macro and the <<back>> macro for details on those.

There are fancier ways to do that, but this is a fairly straightforward one for beginners.

Enjoy! :slight_smile: