I have done something a little similar in one of my stories, though with a random choice of character gender. My code looks like this:
(set: $C1gender to (either: "woman", "man"))
(set: $C1pro to "She")
(set: $C1poss to "her")
(if: $C1gender is "man")[(set: $C1pro to "He") + (set: $C1poss to "his")]
So I used the (either:) macro to make the choice, but it sounds like you would want to allow the player to choose, probably by clicking a link?
But once you have done that, it is pretty easy to use (set:) and (if:) to assign your pronoun variables to the correct gender.
There is no need to add a mathematical “plus” symbol between the two (set:) macro calls within your (if:) macro’s associated Hook. That line should be just…
(if: $C1gender is "man")[(set: $C1pro to "He")(set: $C1poss to "his")]
…or like the following, if you use line-breaks & indentation to format your code…
(if: $C1gender is "man")[
(set: $C1pro to "He")
(set: $C1poss to "his")
]
note: if you are worried about the additional “blank lines” that formatting your code can add to the page , then use Collapsing whitespace markup to suppress them like so…
{
(set: $C1gender to (either: "woman", "man"))
(set: $C1pro to "She")
(set: $C1poss to "her")
(if: $C1gender is "man")[
(set: $C1pro to "He")
(set: $C1poss to "his")
]
}
You use conditional macros like (if:) and (else:) to control which (set:) macros get called based on the current value of the variable you’re storing the end-user’s answer to your question.
note: You code example doesn’t include how you’re tracking the answer to the “girlfriend or boyfriend” question, so in the following example I will assume that answer has been assigned to the $girlfriend variable. I’m also going to assume that variable can only one of two values, those being “girlfriend” or “boyfriend”.
(if: $girlfriend is "girlfriend")[
(set: $her to "her")
(set: $she tp "she")
]
(else:)[
(set: $her to "his")
(set: $she to "he")
]
You can use (naked) Variable markup to inject the current value of those variables into textual content like so…
I see your $girlfriend over there, $she appears to be talking to $her friend Abcdef.