User Tools

Site Tools


conditional_expression

This is an old revision of the document!


Conditional Expression


A conditional expression is an expression that evaluates to either true or false. An operator at the middle of the expression (for example “==” to check equality) is used to compare two different values on each side of the operator (i.e. the left operand and right operand). The expression can also be a standalone variable or property that was previously assigned a Boolean value. You can join multiple conditions together using the “and” keyword (all conditions must evaluate to true) or the “or” keyword (at least one of the conditions must evaluate to true). Refer to the table below for a list of all operators currently supported.

OperatorExpression evaluates to true when:
==Left operand is equal to the right operand.
!=Left operand is not equal to the right operand.
<Left operand is less than the right operand.
< =Left operand is less than or equal to the right operand.
>Left operand is greater than the right operand.
>=Left operand is greater than or equal to the right operand.
containsLeft operand contains one or more of the right operand.
contains[x]Left operand contains at least x of the right operand, where x is a number.

Examples:

global.property["chapter"] == 2

Evaluates to true if the global property “chapter” contains a numerical value equal to 2.

self.property["visited"]

Evalutes to true if the self entity's property “visited” contains the Boolean value of true.

global.property["gems_collected"] < 5

Evaluates to true if the global property “gems_collected” contains a numerical value less than 5.

player.inventory contains[3] "ITEM_0005" and player.stat["level"] >= 10

Evaluates to true if the player has at least 3 of “ITEM_0005” in their inventory and their level is at least 10.

initiator.tags contains "human"

Evaluates to true if the initiator entity's list of model tags includes the tag “human”.

conditional_expression.1581713738.txt.gz · Last modified: 2020/02/14 12:55 by justin