How do I do romance options

Ok so in my game there is romance and flavor text depending on who you are romancing. How do i got about setting the characters sexuality and romance options in the beginning? Im originally from choice script so on theat it would be something like
*if sexuality = blank
*goto blank

and then itd be something like *set sexuality blank
*set ro blank
*if ro = blank
*goto blank

and so on i am using twine sugarcube. Thanks for any help

You might like to consider using the “cycle” macro to let the player make their initial selections. That macro produces a page like this (imagine that the words in square brackets are links):

You are a [tall] [woman] and your alter persona is a [fox].

(more stat setting)

All set? (You won’t be able to change these choices once you start the game.)

[Start the game]

Players click on each link, which will show the next entry in a range of choices.

Here’s what the code would look like:

:: character setup

You're a 
<<cycle "$height" autoselect>>
	<<option "tall">>
	<<option "short">>
<<cycle "$gender" autoselect>>
	<<option "man">>
	<<option "woman">>
	<<option "spirit">>

<<cycle "$persona" autoselect>>
	<<option "fox">>
	<<option "chicken" >>
	<<option "dragon" >>
	<<option "bull">>

All set? (You won’t be able to change these choices once you start the game.)

[[Start the game]]

The player’s choices will be saved into $height, $gender and $persona.

When you’re writing text, you say:

As you're passing the window, you see a $persona dimly reflected in it.


Looking at Malevrendo, <<if $persona is "dragon">>you feel rage fill your heart<<else>>your breath quickens<< end if>>.

(the code as-is will have a lot of ugly whitespace in it, but I’ve left out using the space collapsing options like the <<nobr>> macro for clarity)


There’s lots and lots and lots of ways to do that. It would be best if you specified how you want to look to the players of your game, rather than using pseudocode, since that gives us a clearer idea of what you actually want.

I’d also recommend at least skimming through the SugarCube documentation, that way you can get an idea of what kinds of options are available to you, and you can then later go back and read in detail as needed.

To answer your question, for one example, you might want have the player pick options from a dropdown list using the <<listbox>> macro, which would then set a story variable (a variable with a name that starts with a “$”). Then you can simply use an <<if>> macro to determine what is displayed based on the value of that story variable. For example:

<label for="listbox-gender">''Gender:''</label>
<<listbox "$gender">>
	<<option "Male" selected>>
	<<option "Female">>
	<<option "Non-binary">>

That would let the player select a gender from those three options, with “Male” as the default, and the result would be stored in the $gender story variable. (Note: The “for” attribute in the <label> element should be in the form of “listbox-(story variable name used in the <<listbox>> macro without the “$”)” or, for temporary variables, basically the same, except there should be two dashes after “listbox” and the “_” should be dropped from the variable name.)

Needless to say, that’s just one of many ways to do that. Using <<radiobutton>> macros might be a better idea in cases where it’s only a couple of options and you want all options to be visible at once. Just make sure you set one to be checked by default. Take a look at the documentation for other options.

Later on you could then do:

<<if $gender == "Male">>\
	Male text goes here.
<<elseif $gender == "Female">>\
	Female text goes here.
	Non-binary text goes here.

Note: The “\” characters prevent unnecessary line breaks, while keeping the code easy to read.

If you don’t want to put all of the text that needs to be displayed within a single passage like that, then instead of using a <<goto>> macro, which will break passage navigation if used automatically within a passage (since it prevents the “back” button from working), it’s better to simply use an <<include>> macro, which allows you to display the contents of one passage within a different passage.

Hopefully that all makes sense, but please ask if you have any questions. :slight_smile:

Honestly, I’d recommend against using the <<cycle>> macro, since it’s too easy to confuse it for a standard passage link. There are other, clearer methods to let users select from a number of options.

If you decide you want to use it anyways, I’d recommend adding the following CSS code to your stylesheet:

.macro-cycle::before {
	content: "\e826\00a0";
	font-family: tme-fa-icons;
	font-style: normal;
	font-weight: 400;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	speak: none;

That distinguishes <<cycle>> links from regular links by putting a “cycle” icon in front of them.

That at least makes the syntax of the game’s UI a bit more obvious and less confusing to the players, so that it’s immediately obvious which are cycling links and which are navigation links.

Also, this example code of yours is broken:

Looking at Malevrendo, <<if $persona is "dragon">>you feel rage fill your heart<<else>>your breath quickens<< end if>>.

First, << end if>> isn’t valid code, and <<endif>> is depreciated anyways. You should be using <</if>> to end your <<if>> macros. I’d do it like this:

Looking at Malevrendo,<<if $persona == "dragon">>/
	you feel rage fill your heart/
	your breath quickens/

That makes it a bit easier to read as a developer, while still looking good to the player as well.

Enjoy! :slight_smile:

1 Like

Im a bit confused with all of that is there a simpler way to describe it? Im just very lost and ive gone through the sugarcube and twine manual things and im still confused. Do you have a for dummies way to describe it? Like i want to set the genders of the players first and then they chooses sexualities and then depending on the sexualities certain ros are available. And what page would I put those on? Sorry for all the questions but this is a big learning curve for me from choice script

Well, you could simply use multiple passages, like this:

:: choose gender

Do you want to play as a [[boy->boy chosen]] or a [[girl]]?

:: boy chosen

<<set $gender to "boy">>

Okay, you're a boy!

Are you [[gay->gay chosen]] or [[straight->straight chosen]]

:: gay chosen

<<set $sexuality to "gay">>

Okay, you're playing a $sexuality $gender.

Is that OK? [[yes->start game]]  [[no->choose gender]]

the <<set>> macro remembers each choice by putting the relevant value into the variable. Obviously you’d write passages for the other choices too.

The “no” choice loops them back to the start of the process of defining their character. The value of the variables will be overwritten by their new choices as they step through the process again.

(BTW the two colons in the code are simply indicating “this is the name of the passage” )

Essentially what we’re doing here is using the structure of passages to represent the yes/no/else logic of the other code. If you’re using the GUI, what you’ll see is a structure of boxes and arrows that shows the flow of the choices.

A simpler way to describe what? You need to be more specific about what parts are confusing.

Again, describe what? I tried to make my explanation pretty simple, so if there’s any specifc parts that confused you, then you’re going to have to say what parts. I can’t just guess at random.

Just use the examples you’ve been given. I even gave you code specifically showing how to pick the gender. You only need to tweak that code to have it pick sexualities instead. And I have no idea what you want picking romance options to look like, but it could simply be the same thing again.

At least try it out and play around with it a bit first so you can see what it does.

Put them in whatever passage you want. It’s entirely up to you, since it’s your game. We don’t know what pages your game has or what you want it to look like, so it’s not like we could tell you.

Again, you need to be much more specific when you’re asking questions about what information you need, and be clearer about what you’re trying to achieve, otherwise we can only guess with vague and general answers like the above.

It’s hard to help you if we don’t know specifically what you want or what you’re actually having problems understanding.

Here’s a simple code to achieve description of gender and romantic preferences. I will use the radiobutton macro already pointed by @HiEv. As a rule of thumb you can follow HiEv’s advices, they’re almost every time very good.

So radiobutton allows the player to choose how to fill a variable, its great advantage is that all options are visible at once. So I will propose two variables to choose, one $gender and one $romantic_preference

What's your gender?
<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>

What type of people do attract you?
<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>

Later, and by later I mean in a later passage, not in the passage you put the questions, you will want to use macros like if (again, already linked by HiEv) to test your character. Let’s imagine you have imagined this great character named Hypatia. Hypatia is obviously a woman. So to test is the character is attracted to her:

<<if $romantic_preference is "no preference" || $romantic_preference is "women">>
<<set $Hypatia_romance to "possible">>
<<set $Hypatia_romance to "not possible">>

In this example Hypatia is supposed to be OK with any type of partner, of course you might want to restrict her interests as well, that’s only more conditions.

<<if ($romantic_preference is "no preference" || $romantic_preference is "women") && $gender is "male">>
<<set $Hypatia_romance to "possible">>
<<set $Hypatia_romance to "not possible">>

In this case you need to be either attracted to women or both men and women, and to be yourself a man, to have any chance to be with Hypatia.

Of course, you’ll have to set all possible romances one by one. Don’t forget you might have to change these evalutations if you allow the reader to change romantic preferences during the course of the story.

1 Like