Variables

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

ReturnsMethod
voidclear_game_state ( clear_flag: int = 0 )
voidload_game_state ( load_flag: int = 0 )
Stringparse_variables ( text: String )
boolset_variable ( variable_name: String, value: Variant )
Variantget_variable ( variable_path: String, default: Variant = null, no_warning: bool = false )
voidreset ( variable: String = "" )
boolhas ( variable: String = "" )
Arrayfolders ( )
Arrayvariables ( _absolute: bool = false )
Dictionaryget_autoloads ( )
Dictionarymerge_folder ( new: Dictionary, defs: Dictionary )

Signals

signal variable_changed ( info: Dictionary )

Emitted if a dialogic variable changes, gives a dictionary with the following keys:

KeyValue TypeValue
variableStringThe name of the variable that is getting changed.
new_valueVariantThe 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:

KeyValue TypeValue
variableStringThe name of the variable that is getting changed.
orig_valueVariantThe value that had before.
new_valueVariantThe value that has after the change (the result).
valueVariantThe value that the variable is changed by/to.
value_strStringWhatever 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 ofplayer_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


func folders ( ) ⇒ Array

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.