condition_if_else - ryzom/ryzomcore GitHub Wiki


title: Condition If Else description: published: true date: 2023-03-12T01:07:10.751Z tags: editor: markdown dateCreated: 2023-03-11T14:16:24.983Z

condition_if_else

The condition_if_else action executes one of two sub-actions based on whether the specified condition is matched or not.

Parameters

  • condition expression: The condition expression that is evaluated to determine which sub-action to execute.

Sub-actions

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.

Condition Expression

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.

See also

  • 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.
⚠️ **GitHub.com Fallback** ⚠️