The dataGetVar native AI script function is used to retrieve the content of a script data variable.
(value: s)dataGetVar(name: s) // dataGetVar_s_s
(value: f)dataGetVar(name: s) // dataGetVar_s_f
($state)dataGetVar("Fyros:Patrol1State");
This example code calls the dataGetVar function to retrieve the content of the "Patrol1State" variable in the "Fyros" file. The content is stored in the $state
variable as a string.
(nbPatrol)dataGetVar("Fyros:PatrolCount");
This example code calls the dataGetVar function to retrieve the content of the "PatrolCount" variable in the "Fyros" file. The content is stored in the nbPatrol
variable as a float.
If the specified variable does not exist or cannot be retrieved for any other reason, a warning will be printed in the logs and an empty string or 0 will be returned.