Ren'Py Conditional Statements and names

DarthSeduction

Lord of Passion
Donor
Game Developer
Dec 28, 2017
3,360
5,241
Hi guys,

So, I'm trying to avoid having to write two whole scripts for my game in which I plan to make the incest content optional. If you enable incest, mom, sister, etc will all be in the script. If you disable it, I'll use their names instead. For the most part this only effects the mom, as its natural enough to write the script in a way where I use everyone else's names rather than familial pronouns. What I was thinking was, can I write a conditional statement on a character that makes them display as "mom" or "character name" depending on whether or not the incest flag is true. Further, would there be a way to make it so that when I mention mom in dialogue I can get it to display either mom or mom's name based on the same condition?

It really is only the one character that I really have to worry about, so having to go through and change every reference to mom would be an unnecessarily tedious consumption of my time. Any insight would be appreciated. If there is a different way to do this, that too would be appreciated. I'm kinda learning this as I go, so I might be thinking way too simply, or I might be asking a silly question wherein the answer is "OF COOURRSE".
Thanks everyone, in advance.
 

DSSAlex

Member
Aug 19, 2017
168
160
You can use string variables in text blocks by putting square brackets around them. Let me do a five second script to illustrate.

Code:
define mom=Character("[mom_name]")

init python:
$ mom_name="Mom"

label start:
menu:
    "Do you want Incest?"
    "Yes, please!":
        $ mom_name="Mom"
    "Fuck no, I'm no pervert!":
        $ mom_name="Susan"

"You ask [mom_name] if you are a sex pervert."
if mom_name=="Mom":
    mom "I shouldn't have worried. Of course he is! Hooray!"
else:
    mom "Sadly, no. You are normal."
"fin"
 

DarthSeduction

Lord of Passion
Donor
Game Developer
Dec 28, 2017
3,360
5,241
You can use string variables in text blocks by putting square brackets around them. Let me do a five second script to illustrate.

Code:
define mom=Character("[mom_name]")

init python:
$ mom_name="Mom"

label start:
menu:
    "Do you want Incest?"
    "Yes, please!":
        $ mom_name="Mom"
    "Fuck no, I'm no pervert!":
        $ mom_name="Susan"

"You ask [mom_name] if you are a sex pervert."
if mom_name=="Mom":
    mom "I shouldn't have worried. Of course he is! Hooray!"
else:
    mom "Sadly, no. You are normal."
"fin"

Thanks so much for the answer and the hilarity. That's exactly what I needed to know. It's kinda how I thought it would work too, I'm just not confident in my knowledge yet.
 

DarthSeduction

Lord of Passion
Donor
Game Developer
Dec 28, 2017
3,360
5,241
slight correction, in case anyone else stumbles across this

The $ is not necessary for the initialization to run, so it should look like this.

init python:
mom_name="Mom"​
 

DarthSeduction

Lord of Passion
Donor
Game Developer
Dec 28, 2017
3,360
5,241
@anne O'nymous
@Palanto Games
You guys have both been very helpful, if you have a second can you give me some advice about variables?

I have a conditional statement that I'm sure I should be passing on a variable, but it keeps giving me the else dialogue. If you need more specific information just let me know, and thanks in advance, you guys are awesome.
 
  • Like
Reactions: Palanto

DarthSeduction

Lord of Passion
Donor
Game Developer
Dec 28, 2017
3,360
5,241
@anne O'nymous
@Palanto Games
You guys have both been very helpful, if you have a second can you give me some advice about variables?

I have a conditional statement that I'm sure I should be passing on a variable, but it keeps giving me the else dialogue. If you need more specific information just let me know, and thanks in advance, you guys are awesome.
I'm an idiot. I figured it out. No need to worry now.
 
  • Like
Reactions: Palanto