[Solved] Syntax for combinations of AND/OR conditions

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
tomb
Posts: 19
Joined: Fri Sep 30, 2022 8:23 am

[Solved] Syntax for combinations of AND/OR conditions

Post by tomb »

Hi Tony

I was wondering if there is a valid syntax for checking a mix of AND/OR conditions in a single entry?

For example if I wanted to check (pseudo code):

Code: Select all

If (A == true and B == true) OR (C == true)
i.e. This entry is valid if both A and B are true. This entry is also valid if C is true (regardless of the state of A or B)

At the moment I would do this using two different entries:

Code: Select all

Variable["A"] == true and (Variable["B"] == true)

Code: Select all

Variable["C"] == true
Both entries would have a Continue() sequence and link to the same dialogue entry for the text I wanted to display in this situation.

If I could achieve this check in a single entry that would be helpful. I wondered if it's possible to use brackets to wrap sets of conditions in but I haven't been able to get this to work so far. For example:

Code: Select all

((Variable["A"] == true) and (Variable["B"] == true)) or (Variable["C"] == true)

Thank you

Tom
Last edited by tomb on Tue Jun 04, 2024 9:16 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Syntax for combinations of AND/OR conditions

Post by Tony Li »

Hi Tom,

I just tested that last condition, and it works fine. What issue are you seeing?
tomb
Posts: 19
Joined: Fri Sep 30, 2022 8:23 am

Re: Syntax for combinations of AND/OR conditions

Post by tomb »

Hi Tony

You're right it is working - great to know this is possible!

I must have gotten myself confused.

Thanks

Tom
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Solved] Syntax for combinations of AND/OR conditions

Post by Tony Li »

Glad to help!
Post Reply