This contains the source code documentation of the class subsystem_Variables
.
subsystem_Variables
Inherits: DialogicSubsystem
Subsystem that manages variables and allows to access them.
Methods
Returns | Method |
---|---|
void | clear_game_state ( clear_flag : int = 0 ) |
void | load_game_state ( load_flag : int = 0 ) |
String | parse_variables ( text : String ) |
bool | set_variable ( variable_name : String, value : Variant ) |
Variant | get_variable ( variable_path : String, default : Variant = null , no_warning : bool = false ) |
void | reset ( variable : String = "" ) |
bool | has ( variable : String = "" ) |
Array | folders ( ) |
Array | variables ( _absolute : bool = false ) |
Dictionary | get_autoloads ( ) |
Dictionary | merge_folder ( new : Dictionary, defs : Dictionary ) |
Signals
signal variable_changed ( info
: Dictionary )
Emitted if a dialogic variable changes, gives a dictionary with the following keys:
Key | Value Type | Value |
---|---|---|
variable | String | The name of the variable that is getting changed. |
new_value | Variant | The value that has after the change (the result). |
signal variable_was_set ( info
: Dictionary )
Emitted on a set variable event, gives a dictionary with the following keys:
Key | Value Type | Value |
---|---|---|
variable | String | The name of the variable that is getting changed. |
orig_value | Variant | The value that had before. |
new_value | Variant | The value that has after the change (the result). |
value | Variant | The value that the variable is changed by/to. |
value_str | String | Whatever has been given as the value (not interpreted, so a variable is just a string). |
Method Descriptions
func clear_game_state ( clear_flag
: int = 0
) ⇒ void
No description available.
func load_game_state ( load_flag
: int = 0
) ⇒ void
No description available.
func parse_variables ( text
: String ) ⇒ String
This function will try to get the value of variables provided inside curly brackets and replace them with their values. It will: - look for the strings to replace - search all autoloads - try to get the value from context So if you provide a string like Hello, how are you doing {Game.player_name} it will try to search for an autoload with the name
Gameand get the value of
player_name` to replace it.
func set_variable ( variable_name
: String, value
: Variant ) ⇒ bool
No description available.
func get_variable ( variable_path
: String, default
: Variant = null
, no_warning
: bool = false
) ⇒ Variant
No description available.
func reset ( variable
: String = ""
) ⇒ void
Resets all variables or a specific variable to the value(s) defined in the variable editor
func has ( variable
: String = ""
) ⇒ bool
Returns true if a variable with the given path exists
No description available.
func variables ( _absolute
: bool = false
) ⇒ Array
No description available.
func get_autoloads ( ) ⇒ Dictionary
No description available.
func merge_folder ( new
: Dictionary, defs
: Dictionary ) ⇒ Dictionary
No description available.