Skip to content

get_state

Syntax

get_state(<condition_name>, <state_name>)

Parameters

condition_name
The name of a condition defined in the model.
state_name
The name of a state within the condition.

Returns

Returns an integer representing the state's index in the given condition.

Description

This action returns an integer representing the state's index in the given condition. It can be used in conjunction with other actions like current_state to construct predicates to enable executing different actions depending on an agent's current state.

Examples

if (current_state(MOOD) == get_state(MOOD, Happy)) {
    print("I'm happy!")
}

See Also