Trying to use 'or' but it's not working


I don’t know if I’m being dumb and not using it right, or what.

I have a choice I only want to show up if either variables are true. So-

*label problems
  *if not(var1) or not(var2) #Choice
       *set var 1 true
       *set var 2 true
        *goto problems

The idea is that when you choose that option, it sets a var1 true (and just to make it easy, var 2, too, though in reality it doesn’t get set true until a choice further in). But, every time I loop back, it doesn’t work. The choice still shows up. Though, if I trigger the second variable, it disappears (like an and). If I delete the second variable in the choice it works though.


I think it should be

  *if ((var1 = false) or (var2 = false)) #option
    *goto place

I’ve had trouble using *if not (var) in multi-variable *if statements so I do that, but most importantly you need the double parentheses. Also make sure your *goto is indented correctly. It looks like you have an extra space above


In addition to what @sviyagin suggested, you should also do:

      *set var1 true
      *set var2 true

instead of

       *set var 1 true
       *set var 2 true

(Since, the space 'n all.)


@sviyagin I gave it a go but doesn’t seem to work either.

@UNOwen That’s my fault, that’s not how it’s actually written in my game (didn’t want to write it all out cause it’s scenes that are completely written out and didn’t want to make it look more convoluted than it needed to be :p)


Can you tell us the error you get when you run quicktest and/or randomtest?

Edit: I also just noticed that this is a loop. I.e. when your code runs this and goes to *label problems, it re-runs the same code


I’m not getting any errors.

Technically how I have it is there’s a couple of choices, but as you go through them and trigger certain variables, they disappear. So when you pick the first option you can trigger it’s variables one of two ways (so basically you can back out and choose it again). After you go through the scenes it’s supposed to loop back. If I go through and trigger the second variable, it disappears like it should, but not with the first one. If I take away the second variable (so it’s just *if not(var1)) it triggers as well.


Why not copy-paste the section(s) in question and then replace the actual text with something like ‘[text]’? Maybe you misspelled one of the variables you’re trying to set?

Edit: In addition, are you certain you tried:

*if ((not(var1)) or (not(var2))) #Choice


It’s hard to visualize what you mean by “it doesn’t get set true until a choice further in.” Could you post the entire section of code?

*label top
	*if (not(chance) or not(rchance))
		#Look for Chance
				#A good friend
						#Go with him
							*if not(unimportant variable)
								*set chance true
									#Go back 
										*goto top
									#It's time to go home
								*set chance true
								*goto bottom
						#Go look for someone else.
							*set rchance true
							*goto top
				#Go look for someone else.
					*goto top

*label bottom
*goto top

This is the entire segment of code (sans paragraphs). I wondered if it was the placement of the variable to set it true.

Just tried doing the parenthesis that way and still a no go.



Are you trying to make it so that if the player sets off either chance or rchance the option hides? In which case, you’re using the wrong expression. Use ‘and’ instead of ‘or’. The way it currently is, both flags need to be set for the choice to hide.



I’ve been messing around for choicescript for years and apparently didn’t understand the and function.

This might explain some things.

Thank you!


No problemo.

This is why posting the entire code was important – in the example you gave us in the opening post, both flags seemed to be set properly and at the same time, so there was no way to properly tell what the issue (or what you were trying to do exactly) might’ve been.


code stretching thirty meters off the right side of the screen

This is why I use double space instead of tab or quadruple space!


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