Choicescript "if variable is true" question

I’m sure this is somewhere in the advanced techniques forum, but I just can’t quite find it, or maybe I’m just not understanding what it says on there. I need to write a script for a scene in my story. For the scene, I need to skip over a certain part if a variable is set true. But I have two variables to take into account for it, and if either one is set true, then the part needs to be skipped.

I’ve already tried writing it out like

*if (character1met)
–*goto nextscene
*else
–*goto skippedscene

*if (character2met)
–*goto nextscene
*else
–*goto skippedscene

But when I do that, the first script is the only one that behaves right when I set it to true. The second one won’t. So how should I write this out?

actually I’m realizing how this won’t work, since it is already reading the first script as false even if the other is set as true, it will still go to the next scene. So how am I supposed to get around this.

You can use or or and in between the the conditions, like this:
*if (character1met) or (character2met)
-*goto nextscene
*else
-goto skippedscene
However, if you have more than two than you’ll need to use more brackets like this:
*if ((character1met) or (character2met)) or (someotherguymet)

1 Like

oh, okay I see what you mean. So if I have four it would need to be labeled
*if ((character1met) or (character2met)) or ((character3met) or (character4met))

Thanks for your help :smiley:

If you’re not crazy about using parentheses (like me) with ors you can also usually just drop them one after the other:


*if (character1met)
  *goto nextscene
*if (character2met) 
  *goto nextscene
*if (character3met)
  *goto nextscene
*goto skippedscene

^Very good, legible method.

Ah okay I see what you mean, you just don’t include the else after each one and it works out :).

I know I’m digging up an older thread here, but I think choicescript also has an *elseif function. If you replaced the second *if from above (in Colourz’ post) and removed the first *else, it would also work.