The dataSetVar native AI script function sets the value of a persistent script data variable. These variables survive AI service restarts and are automatically saved by the Backup Service.
()dataSetVar(name: s, value: s) // set string value
()dataSetVar(name: s, value: f) // set float value
"filename:variablename". See dataGetVar for details on the naming convention.Setting a variable marks the data as dirty. The Backup Service automatically detects this and saves all variables to ai_script_data/<ais_name>_pdr.bin. You do not need to call dataSave() — persistence is automatic.
Variables are scoped to the AI service instance, not to a specific group. Any group in the same instance can read variables set by another group.
// Store a string state
()dataSetVar("Fyros:Patrol1State", "Active");
// Store a counter
(count)dataGetVar("Fyros:PatrolCount");
count = count + 1;
()dataSetVar("Fyros:PatrolCount", count);
// Track tribe camp state across restarts
()dataSetVar("Tribes:CampAlpha_TileCount", tileCount);
()dataSetVar("Tribes:CampAlpha_LastEvent", $eventName);
dataSetVar and the next Bsi save cycle, the most recent changes may be lost.Source: ryzom/server/src/ai_service/nf_static.cpp (dataSetVar_ss_, dataSetVar_sf_), ryzom/server/src/ai_service/ai_script_data_manager.cpp