data_set_var - ryzom/ryzomcore GitHub Wiki
title: Data Set Var description: published: true date: 2023-03-16T23:05:54.946Z tags: editor: markdown dateCreated: 2023-03-16T22:22:10.171Z
The dataSetVar native AI script function changes the content of a script data variable. The data variable name is composed of a file name and a variable name separated with :
, like in "file:variable"
.
()dataSetVar(name: s, value: s); // dataSetVar_ss_
()dataSetVar(name: s, value: f); // dataSetVar_sf_
-
name (string): The name of the data variable in the format
"file:variable"
. - value (string or float): The content of the data variable.
()dataSetVar("Fyros:Patrol1State", "Active");
This example code sets the content of the "Fyros:Patrol1State"
data variable to "Active"
.
()dataSetVar("Fyros:PatrolCount", nbPatrol);
This example code sets the content of the "Fyros:PatrolCount"
data variable to the value of the nbPatrol
variable.
The name
argument must be a string in the format "file:variable"
. If the file or variable name does not exist, it will be created.
The value
argument can be a string or a float. If it is a float, it will be converted to a string before being stored.