This function can be used to set a stat to a string for the given user ID. You supply the user ID as returned by (for example) the function xboxlive_get_user(), then the stat string to set (if the stat string does not already exist then a new stat will be created and set to the given value) and then the string to set the stat to. Note that the stat name must be alphanumeric only, with no symbols or spaces, but the string value you are setting can have spaces and special characters.
When setting the stat string, any previous string will be overridden, therefore it is up to you to determine if the stat string should be updated or not by comparing to the current stat string with the new one before setting it.
The function will will return -1 if there was an error or the user ID is invalid, or any other value if the function was successfully called.IMPORTANT! This function is only valid when exporting using the UWP target for the Xbox One and it requires you to have checked the Enable XBox Live option in the UWP Game Options.
xboxlive_stats_set_stat_string(user_id, stat, value);
Argument Description user_id The user ID pointer to set the stat for stat The statistic to set (a string) value The value to set the stat to (a string)
The above code sets the stat "LevelName" to the string stored in the given global variable.Â