FANDOM


//RWT-OEI 03/28/06
//This function sets the string value of a local GUI variable on the client of
//the indicated player
void SetLocalGUIVariable( object oPlayer, string sScreenName, int nVarIndex, string sVarValue );

This function (or AddListBoxRow / ModifyListBoxRow when the variable parameter is set) is used in conjunction with the GUI command UIObject_Misc_ExtractData to pass data from your function to a UIScreen (sScreenName parameter). That data is stored at nVarIndex (best not to use 0-3 as some system functions use these index numbers) typically, to be retrieved by UIObject_Misc_ExtractData which passes the data into the UI functions UIObject_Input_ActionTargetScript or UIObject_MISC_ExecuteServerScript. For more information on UI functions go here.

Scripts which receive data from UIObject_Misc_ExtractData and are run out of UIObject_MISC_ExecuteServerScript or UIObject_Input_ActionTargetScript typically take the format of:

void main (string sData)
{
     int nData = StringToInt(sData);
     float fData = StringToFloat(sData);
     ect, ect
}

This is example assumes that the data is stored as a string. You don't have to, but it might be wise because using a string allows you the option to store multiple data types on a single variable. This is accomplished by tethering the data you want into a single string:

void main()
{
     string sData = "1" + "2.3f" + "alpha";
     SetLocalGUIVariable(oPC, sScreenName, nVarIndex, sData);
}

When the string is extracted into the receiving function you can disassemble the data using GetSubString or GetStringLeft or GetStringRight. Here's an example:

void main(sData)
{
     int nData = StringToInt(GetSubString(sData, 0, 1));
     float fData = StringToFloat(GetSubString(sData, 1, 4));
     string sSub = GetSubString(sData, 5, 5);
}

As long as you know the position and length of the data in the string you disassemble you can store just about anything on a single variable.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.