data_set_var - ryzom/ryzomcore GitHub Wiki


title: Data Set Var description: published: true date: 2023-03-14T03:27:16.554Z tags: editor: markdown dateCreated: 2023-03-14T03:27:16.554Z

dataSetVar

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".

Syntax

()dataSetVar(name: s, value: s); // dataSetVar_ss_
()dataSetVar(name: s, value: f); // dataSetVar_sf_

Arguments

  • name (string): The name of the data variable in the format "file:variable".
  • value (string or float): The content of the data variable.

Examples

()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.

Notes

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.

⚠️ **GitHub.com Fallback** ⚠️