Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

And/or in if statements?

9 years ago
Hi,
With this scripting language, is it possible to do something like:
IF %VAR1 := 1 OR %VAR2 := 3
or:
IF %VAR1 := 2 AND %VAR2 := 4

I just want to know this because there is a complicated script I need to do for a game that involves if statements, but with and and or, they could be a lot simpler.

And/or in if statements?

9 years ago

Yeah, AND and OR work with equalities, but not inequalities, barring negation (i.e. you can't use <, <=, >, or >= when using AND or OR, but you can use !=; it's a bug). With inequalities, you need to use nested IFs. Also, know that comparative equals is different from assignment equals, so for IF statements, you don't need the colon (i.e. "IF %VAR1 = 1").

And/or in if statements?

9 years ago
Ah, that was the issue. Only = works.

And/or in if statements?

9 years ago
Thanks.

And/or in if statements?

9 years ago
You can. I just did some testing, and it worked fine, but others have had issues with it. Make sure to use brackets.

IF (%VAR1 = 1 OR %VAR2 = 3) OR (%VAR1 = 2 AND %VAR2 = 4) THEN

Would be the format.

And/or in if statements?

9 years ago

Nice find Killa!