Consider the radiobuttons like a sequential iteration … convert the/your current value to an id and store it on the module-object … when the gui opens the currently active id is at the top … when a button is selected, add the id of that button to the stored value and convert the result back to a proper gui-local
// gui_pia_open
string sVal = GetCampaignString(PIA_DATABASE, db_PIA_FB);
if (sVal == "") sVal = PRINT_NONE;
SetLocalGUIVariable(oSelf, PIA_GUI_SCREEN, 21, sVal);
if (sVal != PRINT_NONE) // else use defaults
{
string s0,s1,s2,s3; int iPrint;
if (sVal == PRINT_CHAT)
{
s0 = "print chat";
s1 = "print file";
s2 = "print both";
s3 = "print none";
iPrint = 1;
}
else if (sVal == PRINT_FILE)
{
s0 = "print file";
s1 = "print both";
s2 = "print none";
s3 = "print chat";
iPrint = 2;
}
else if (sVal == PRINT_BOTH)
{
s0 = "print both";
s1 = "print none";
s2 = "print chat";
s3 = "print file";
iPrint = 3;
}
SetGUIObjectText(oSelf, PIA_GUI_SCREEN, "PIA_PRINT_0_TEXT", -1, s0);
SetGUIObjectText(oSelf, PIA_GUI_SCREEN, "PIA_PRINT_1_TEXT", -1, s1);
SetGUIObjectText(oSelf, PIA_GUI_SCREEN, "PIA_PRINT_2_TEXT", -1, s2);
SetGUIObjectText(oSelf, PIA_GUI_SCREEN, "PIA_PRINT_3_TEXT", -1, s3);
SetLocalInt(GetModule(), PIA_FB_TEMP, iPrint);
}
<UIButton name="PIA_PRINT_0_RB" x="220" y="32" style="ROUND_RADIO_BUTTON" groupid="20" groupmemberid="1"
OnSelected='UIObject_Misc_ExecuteServerScript("gui_pia_radio","21","0")' />
<UIText name="PIA_PRINT_0_TEXT" text="print none" x="250" y="32" width="64" height="20"
align="left" valign="middle" fontfamily="Default" style="bold" />
<UIButton name="PIA_PRINT_1_RB" x="220" y="56" style="ROUND_RADIO_BUTTON" groupid="20" groupmemberid="2"
OnSelected='UIObject_Misc_ExecuteServerScript("gui_pia_radio","21","1")' />
<UIText name="PIA_PRINT_1_TEXT" text="print chat" x="250" y="56" width="64" height="20"
align="left" valign="middle" fontfamily="Default" style="bold" />
<UIButton name="PIA_PRINT_2_RB" x="220" y="80" style="ROUND_RADIO_BUTTON" groupid="20" groupmemberid="3"
OnSelected='UIObject_Misc_ExecuteServerScript("gui_pia_radio","21","2")' />
<UIText name="PIA_PRINT_2_TEXT" text="print file" x="250" y="80" width="64" height="20"
align="left" valign="middle" fontfamily="Default" style="bold" />
<UIButton name="PIA_PRINT_3_RB" x="220" y="104" style="ROUND_RADIO_BUTTON" groupid="20" groupmemberid="4"
OnSelected='UIObject_Misc_ExecuteServerScript("gui_pia_radio","21","3")' />
<UIText name="PIA_PRINT_3_TEXT" text="print both" x="250" y="104" width="64" height="20"
align="left" valign="middle" fontfamily="Default" style="bold" />
// gui_pia_radio(int iLocal, int iCycle)
string sPrint;
switch ((GetLocalInt(GetModule(), PIA_FB_TEMP) + iCycle) % 4)
{
default:
case 0: sPrint = PRINT_NONE; break;
case 1: sPrint = PRINT_CHAT; break;
case 2: sPrint = PRINT_FILE; break;
case 3: sPrint = PRINT_BOTH; break;
}
SetLocalGUIVariable(OBJECT_SELF, PIA_GUI_SCREEN, iLocal, sPrint);
But id still like to know how to load a gui with a desired radiobutton selected …