-
Notifications
You must be signed in to change notification settings - Fork 94
condition_if_else
title: Condition If Else description: published: true date: 2023-03-16T23:13:32.129Z tags: editor: markdown dateCreated: 2023-03-16T22:31:55.789Z
The condition_if_else action executes one of two sub-actions based on whether the specified condition is matched or not.
- condition expression: The condition expression that is evaluated to determine which sub-action to execute.
This action should take two sub-actions. If the condition is matched then the first sub action is executed. otherwise the second sub action is executed.
The weights of the sub-actions are used to determine the order and which sub-action to execute. If the condition is matched, and the weights are different, the sub-action with the lower weight will be executed.
The condition expression must match the following pattern:
<local_variable> <operator> <local_variable|foreign_variable|constant_value>
where operator
can be one of <
, >
, =
, !=
, <=
, >=
.
Each group has a set of 4 variables with IDs ranging from 0 to 3. Local variables are the variables of the current group and are expressed with a v
followed by the variable ID (0-3). For example: v0
.
Foreign variables are variables that come from another group and are expressed with the group name followed by a colon (:
) and then followed by a local variable identifier (v
). For example: group_1:v2
. Note that foreign variables are accessible only if the group name is unique in the world.
Constant values are floating point numerical expressions in base 10.
- Condition If: A similar action that performs a conditional test and executes a sub-action if the condition is met.
-
Modify Variable: An action that modifies a variable in a group by performing arithmetic operations with other variables or constants. This action can be useful in conjunction with
condition_if_else
. -
Code: An action that executes a block of AI script code. This action can be used for more advanced conditional testing and branching that cannot be achieved with
condition_if_else
.