Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Checking Multiple Variables?

one year ago

I want a link to check for two variables, AA and BB, to lead to another page (P46) if both are greater than 1.

I tried this:

IF %AA > 1 AND %BB > 1 THEN
$DEST := @P45

But it doesn't work; it just goes to the linked page (P43) instead of P45. If I removed either one of the variables like so:

IF %BB > 1 THEN
$DEST := @P45

It does work. I am brought to P45.

I tested the game with variables on page to double-check that the values were indeed greater than 1 as well.

I'm sure I'm making some silly mistakes here, like maybe this is not how you check for two variables at once?

Apologies for the stupid question, and thank you in advance.

Checking Multiple Variables?

one year ago

Not sure what's wrong with your code, but you can have it do the same thing by having nested if statements. I always do that instead of using And/or on this site.

Checking Multiple Variables?

one year ago
Maybe try

IF %AA > 1
AND
IF %BB > 1
THEN

Checking Multiple Variables?

one year ago

Gryphon and Mizal are right about nesting. AND, OR, and NOT work with = and !=, but there's a bug that breaks them when less/greater thans are involved.

Checking Multiple Variables?

one year ago

Thank you all!

Using AND seems to not work, so I tried the below which worked (triggers when both AA and BB are greater than 1, but not when only one of them is).

IF %AA > 1 
THEN
IF %BB >1 THEN
$DEST := @P45

Checking Multiple Variables?

one year ago
So is this AND thing listed as a bug somewhere where it may be potentially fixed someday? I know it's been around awhile.

Checking Multiple Variables?

one year ago

It's mentioned in this 8 to 3 year old thread: https://chooseyourstory.com/forums/bugs-and-problems/message/15841