User Tools

Site Tools


conditional_expression

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
conditional_expression [2017/08/06 12:45]
justin
conditional_expression [2020/02/14 12:55] (current)
justin
Line 2: Line 2:
 ---- ----
  
-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). Refer to the table below for a list of all operators currently supported.+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.
  
 ^Operator^Expression evaluates to true when:^ ^Operator^Expression evaluates to true when:^
Line 10: Line 10:
 |< =|Left operand is **less than or equal to** 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** the right operand.|
-|> =|Left operand is **greater than or equal to** the right operand.|+|>=|Left operand is **greater than or equal to** the right operand.|
 |contains|Left operand **contains one or more of** the right operand.| |contains|Left 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:​==== ====Examples:​====
-<​code ​lua+<​code ​bauxite
-self.property["​visited"] == true+global.property["​chapter"] == 2
 </​code>​ </​code>​
-<​code ​lua+Evaluates to true if the global property "​chapter"​ contains a numerical value equal to 2. 
-global.property["​gems_collected"​] ​>= 5+<​code ​bauxite
 +self.property["​visited"]
 </​code>​ </​code>​
-<​code ​lua+Evalutes to true if the self [[entity|entity'​s]] property "​visited"​ contains the [[Boolean]] value of true. 
-player.inventory contains ​"Gold Key"+<​code ​bauxite
 +global.property["gems_collected"] < 5
 </​code>​ </​code>​
 +Evaluates to true if the global property "​gems_collected"​ contains a numerical value less than 5.
 +<code bauxite>
 +player.inventory contains[3] "​ITEM_0005"​ and player.stat["​level"​] >= 10
 +</​code>​
 +Evaluates to true if the player has at least 3 of "​ITEM_0005"​ in their inventory and their level is at least 10.
 +<code bauxite>
 +initiator.tags contains "​human"​
 +</​code>​
 +Evaluates to true if the initiator [[entity|entity'​s]] list of model tags includes the tag "​human"​.
  
conditional_expression.1502048714.txt.gz · Last modified: 2017/08/06 12:45 by justin