Can you place an if statement directly within the name of a choice label?

Hey, everyone!

I’m going to take a wild wager that this is a big no.

Now, I didn’t know how to word the headline, so I’m going to give an example instead.

In this case, there is an event in Once in a Lifetime that makes the mother die at birth. When I’m showing the relationship interface in the below image, you can see each of the names.

Example Relationship Image

What I’m curious about is if I can append that choice’s text based upon an if condition. If the mother died, her name would show, their closeness would show (or be hidden), and then there’d be the text - Deceased.

Full example being:

Penelope Alvarez (Mother - Deceased).

I’m going to wager that if I wanted to show them as deceased, I would need to create duplicates under the if statement, but I’m gonna hope someone knows something I don’t, haha!

Thanks a bunch!

I don’t think you can put an *if command in the middle of a choice (because the choice needs to be an unbroken line), but what you can do is use multireplace.

In this case, your code for this choice would look something along the lines of:

#Penelope Alvarez (Mother - @{mother_alive Closeness: 100%|Deceased})
6 Likes

Appreciate you a ton Corvus!

I completely forgot about multireplace as I’ve never used it. That’s absolutely awesome, and you’re a lifesaver!

1 Like

Hey Corvus!

I should’ve plugged it in first, I’m getting an error of being unable to extract another token. I’m going to wager this is because Closeness uses ${closeness_mother} to declare the value.

The entire line is as such,

#${name_first_mother} ${name_last_mother} (Mother - @{Closeness: ${closeness_mother}%|Deceased})

The error produced is:

Error: Invalid expression, couldn’t extract another token: :

I just realized I forgot the main component.

:man_facepalming:

We’re good, I’m an idiot. It worked!

1 Like

Glad you figured it out! To be clear on the problem for anyone reading this in future: multireplace doesn’t use a colon : after the name of the variable.

Multireplace in options is a total lifesaver. If you’re going to use it a lot, worth getting your head around the wiki.

4 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.