Using *if command properly

The IF thingy not working even tho everything seems right idunno why.

so here code in startup file

*create gender “”

Here how its sit in chapter 1 using fake choice

#blahblahblahblah
*set gender “female”
#blahblahblahblah
*set gender “male”

now cuz my game uses a lot of gender difference I use IF thingy a lot

*if gender = “female”
blablablablabbla

*if gender = “male”
blablablablabbla

Now when I test the game nothing under the IF command shows up and idunno why.

Why aren’t you using if else instead of if if?

1 Like

I am no expert, and can’t provide a concrete answer without seeing the full code, but it seems like the code skips the

Part. The two ifs don’t show because gender value is still “”. Perhaps checking the control flow will help? Just make sure that the gender variable can only take either “male” or “female” after the fake choice.

1 Like

huh what you mean? :hushed: The one I’m using just seem more easy to me.

1 Like

It is usually recommended that you use if else to check conditions if you only need one of them to check true. Otherwise, the code is more prone to errors.

From what you are checking there, it seems it’ll be better, cause if gender is not “female” and there are only two options as you shown, you don’t need to check for the second one.

*if gender = “female”
  blablablablabbla
*else
  blablablablabbla

You could also use a variable true/false or 0/1 instead of a string “female”/“male”
I think it makes the checking easier and you can also use the same variable to do multireplace.

*set gender 0
*comment *set gender false

*if gender
  this will be shown if gender is 1 or true
*else
  this will be shown if the gender is 0 or false

*set gender 1
*comment use gender values 1 and 2 if you are going to use multireplace. the value 0 doesn't work for this.

@{gender this will be shown if the gender is 1|this will be shown if the gender is 2}

But you can use whatever it’s easier for you though, as long as it works.

3 Likes

Note that for minor variations you can use multireplace, like this:
@{(gender = "female") this text will show if mc is a woman|and this will show otherwise}

2 Likes

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