Jump to content
sizraide

(FIXED) Getting all groups from specific faction in CfgGroups

Recommended Posts

Hello,

 

I have a script here that completely works by itself standalone.

test.sqf

Spoiler

_inheritGroup = 
{
	private _factionName = "rhs_faction_usarmy_wd";
	private _factionGroups = "true" configClasses (configFile >> "CfgGroups" >> "West" >> _factionName);
	private _groupNames = [];

	{
		private _factionClass = configName _x;
		private _allGroups = "true" configClasses (configFile >> "CfgGroups" >> "West" >> _factionName >> _factionClass);
		private _placeholderArray = [];

		for "_i" from 0 to (count _allGroups - 1) do {
			private _groupName = configName (_allGroups select _i);
			_placeholderArray pushBack _groupName;
		};

		_groupNames pushBack [_factionClass, _placeholderArray];

	} forEach _factionGroups;
	_groupNames;
};

// Debug
copyToClipboard str ([] call _inheritGroup);

 

 

Output

Spoiler

[
	["rhs_group_nato_usarmy_wd_infantry",["rhs_group_nato_usarmy_wd_company_hq","rhs_group_nato_usarmy_wd_platoon_hq","rhs_group_nato_usarmy_wd_infantry_squad","rhs_group_nato_usarmy_wd_infantry_weaponsquad","rhs_group_nato_usarmy_wd_infantry_squad_sniper","rhs_group_nato_usarmy_wd_infantry_team","rhs_group_nato_usarmy_wd_infantry_team_MG","rhs_group_nato_usarmy_wd_infantry_team_AA","rhs_group_nato_usarmy_wd_infantry_team_support","rhs_group_nato_usarmy_wd_infantry_team_heavy_AT"]],
	["rhs_group_nato_usarmy_wd_infantry_arb",["rhs_group_nato_usarmy_wd_company_hq","rhs_group_nato_usarmy_wd_platoon_hq","rhs_group_nato_usarmy_wd_infantry_squad","rhs_group_nato_usarmy_wd_infantry_weaponsquad","rhs_group_nato_usarmy_wd_infantry_squad_sniper","rhs_group_nato_usarmy_wd_infantry_team","rhs_group_nato_usarmy_wd_infantry_team_MG","rhs_group_nato_usarmy_wd_infantry_team_AA","rhs_group_nato_usarmy_wd_infantry_team_support","rhs_group_nato_usarmy_wd_infantry_team_heavy_AT"]],
	["rhs_group_nato_usarmy_wd_RG33",["rhs_group_nato_usarmy_wd_RG33_squad","rhs_group_nato_usarmy_wd_RG33_squad_2mg","rhs_group_nato_usarmy_wd_RG33_squad_sniper","rhs_group_nato_usarmy_wd_RG33_squad_mg_sniper","rhs_group_nato_usarmy_wd_RG33_m2_squad","rhs_group_nato_usarmy_wd_RG33_m2_squad_2mg","rhs_group_nato_usarmy_wd_RG33_m2_squad_sniper","rhs_group_nato_usarmy_wd_RG33_m2_squad_mg_sniper"]],
	["rhs_group_nato_usarmy_wd_FMTV",["rhs_group_nato_usarmy_wd_FMTV_1078_squad","rhs_group_nato_usarmy_wd_FMTV_1078_squad_2mg","rhs_group_nato_usarmy_wd_FMTV_1078_squad_sniper","rhs_group_nato_usarmy_wd_FMTV_1078_squad_mg_sniper","rhs_group_nato_usarmy_wd_FMTV_1083_squad","rhs_group_nato_usarmy_wd_FMTV_1083_squad_2mg","rhs_group_nato_usarmy_wd_FMTV_1083_squad_sniper","rhs_group_nato_usarmy_wd_FMTV_1083_squad_mg_sniper"]],
	["rhs_group_nato_usarmy_wd_HMMWV",["BUS_MotInf_Team_GMG","BUS_MotInf_Team_HMG","BUS_MotInf_AT","BUS_MotInf_AA"]],
	["rhs_group_nato_usarmy_wd_M113",["rhs_group_nato_usarmy_wd_M113_squad","rhs_group_nato_usarmy_wd_M113_squad_2mg","rhs_group_nato_usarmy_wd_M113_squad_sniper","rhs_group_nato_usarmy_wd_M113_squad_mg_sniper"]],
	["rhs_group_nato_usarmy_wd_bradley",["rhs_group_nato_usarmy_wd_bradley_squad","rhs_group_nato_usarmy_wd_bradley_squad_2mg","rhs_group_nato_usarmy_wd_bradley_squad_sniper","rhs_group_nato_usarmy_wd_bradley_squad_mg_sniper","rhs_group_nato_usarmy_d_bradley_aa"]],
	["rhs_group_nato_usarmy_wd_bradley_busk",["rhs_group_nato_usarmy_wd_bradley_squad","rhs_group_nato_usarmy_wd_bradley_squad_2mg","rhs_group_nato_usarmy_wd_bradley_squad_sniper","rhs_group_nato_usarmy_wd_bradley_squad_mg_sniper","rhs_group_nato_usarmy_d_bradley_aa"]],
	["rhs_group_nato_usarmy_wd_bradleyA3",["rhs_group_nato_usarmy_wd_bradleyA3_squad","rhs_group_nato_usarmy_wd_bradleyA3_squad_2mg","rhs_group_nato_usarmy_wd_bradleyA3_squad_sniper","rhs_group_nato_usarmy_wd_bradleyA3_squad_mg_sniper","rhs_group_nato_usarmy_d_bradleyA3_aa"]],
	["rhs_group_nato_usarmy_wd_bradleyA3_busk",["rhs_group_nato_usarmy_wd_bradleyA3_squad","rhs_group_nato_usarmy_wd_bradleyA3_squad_2mg","rhs_group_nato_usarmy_wd_bradleyA3_squad_sniper","rhs_group_nato_usarmy_wd_bradleyA3_squad_mg_sniper","rhs_group_nato_usarmy_d_bradleyA3_aa"]],
	["rhs_group_nato_usarmy_wd_bradleyA3_busk3",["rhs_group_nato_usarmy_wd_bradleyA3_squad","rhs_group_nato_usarmy_wd_bradleyA3_squad_2mg","rhs_group_nato_usarmy_wd_bradleyA3_squad_sniper","rhs_group_nato_usarmy_wd_bradleyA3_squad_mg_sniper","rhs_group_nato_usarmy_d_bradleyA3_aa"]],
	["rhs_group_nato_usarmy_wd_stryker",["rhs_group_nato_usarmy_wd_stryker_squad","rhs_group_nato_usarmy_wd_stryker_wpnsquad"]],
	["rhs_group_nato_usarmy_wd_m1a1",["RHS_M1A1AIM_wd_Platoon","RHS_M1A1AIM_wd_Platoon_AA","RHS_M1A1AIM_wd_Section","RHS_M1A1AIM_wd_TUSK_Platoon","RHS_M1A1AIM_wd_TUSK_Platoon_AA","RHS_M1A1AIM_wd_TUSK_Section"]],
	["rhs_group_nato_usarmy_wd_M1A2",["RHS_M1A2SEP_wd_Platoon","RHS_M1A2SEP_wd_Platoon_AA","RHS_M1A2SEP_wd_Section","RHS_M1A2SEP_wd_TUSK_Platoon","RHS_M1A2SEP_wd_TUSK_Platoon_AA","RHS_M1A2SEP_wd_TUSK_Section","RHS_M1A2SEP_wd_TUSK2_Platoon","RHS_M1A2SEP_wd_TUSK2_Platoon_AA","RHS_M1A2SEP_wd_TUSK2_Section"]],
	["rhs_group_nato_usarmy_wd_M109",["RHS_M109_wd_Platoon","RHS_M109_wd_Section"]]
];

 

 

 

However, when implemented into my scripts that takes in the currently selected faction from a GUI, it completely breaks down.

 

get_variables.sqf

Spoiler

/****************************************************************
Gather all groups from each faction
****************************************************************/

private _SIZ_fn_inheritGroup = 
{
	private _factionName = (_this select 0);
	private _side = (_this select 1);
	private _groupNames = [];

	switch(_side) do 
	{
		case 0: {_side = "East"};
		case 1: {_side = "West"};
		case 2: {_side = "Indep"};
	};
	
	private _factionGroups = "true" configClasses (configFile >> "CfgGroups" >> _side >> _factionName);
	{
		private _factionClass = configName _x;
		private _allGroups = "true" configClasses (configFile >> "CfgGroups" >> _side >> _factionName >> _factionClass);
		private _placeholderArray = [];

		for "_i" from 0 to (count _allGroups - 1) do 
		{
			private _groupName = configName (_allGroups select _i);
			_placeholderArray pushBack _groupName;
		};

		_groupNames pushBack [_factionClass, _placeholderArray];

	} forEach _factionGroups;
	_groupNames;
};

// INDEP
private _ctrl = (findDisplay 0001) displayCtrl 2105;
private _index = lbCurSel _ctrl;
private _factionName = _ctrl lbData _index;
_INDEP_GroupsArray = [_factionName, 2] call _SIZ_fn_inheritGroup;

// OPFOR
private _ctrl = (findDisplay 0001) displayCtrl 2106;
private _index = lbCurSel _ctrl;
private _factionName = _ctrl lbData _index;
_OPFOR_GroupsArray = [_factionName, 0] call _SIZ_fn_inheritGroup;

// BLUFOR
private _ctrl = (findDisplay 0001) displayCtrl 2107;
private _index = lbCurSel _ctrl;
private _factionName = _ctrl lbData _index;
_BLUFOR_GroupsArray = [_factionName, 1] call _SIZ_fn_inheritGroup;

[
	_OPFOR_GroupsArray, 
	_BLUFOR_GroupsArray,
	_INDEP_GroupsArray,
	_RandomArt,
	_BetterSounds,
	_AmbientCombatSounds,
	_RandomTime,
	_RandomWeather,
	_Difficulty,
	_PlayerGroup
];

// Debug
copyToClipboard str 
[
	_OPFOR_GroupsArray, 
	_BLUFOR_GroupsArray,
	_INDEP_GroupsArray
];

 

 

Output (currently)

Spoiler

// Output
[
	[],
	[],
	[["Infantry",["I_G_InfSquad_Assault","I_G_InfTeam_Light"]]]
]

 

As you can see, for some reason it doesn't fill out the array.

 

Here are my other files (GUI files):

controls.hpp

Spoiler

class MenuScreen 
{
    idd = 0001;
    onKeyDown = "if ((_this select 1) isEqualTo 1) then {false};";

    class controls
    {
        class SettingsStart: RscButton
        {
            idc = 1600;
            text = "START"; 
            style = ST_CENTER;
            font = "PuristaBold";
            x = 0.849453 * safezoneW + safezoneX;
            y = 0.934 * safezoneH + safezoneY;
            w = 0.152578 * safezoneW;
            h = 0.07 * safezoneH;
            sizeEx = 0.05 * safezoneH;
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.5
            };
            colorBackgroundActive[] = 
            {
                0,
                0,
                0,
                0.5
            };
            action = "execVM 'escape_script\menu\confirm_settings.sqf'";
        };
        class SettingsFrame: RscPicture
        {
            text = "images\background.paa";
            idc = 1800;
            x = 0.849453 * safezoneW + safezoneX;
            y = -0.00399977 * safezoneH + safezoneY;
            w = 0.152578 * safezoneW;
            h = 0.938 * safezoneH;
            //colorBackground[] = {0,0,0,0.5};
        };
        class RandomArt_Title: RscStructuredText
        {
            idc = 1100;
            text = "Random Artillery"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.234 * safezoneH + safezoneY;
            w = 0.142734 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            tooltip = "Enable random artillery around the player(s).";
            colorBackground[] = {0,0,0,0};
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                colorLink = "#D09B43";
                shadow = 1;
                size = 1;
            };
        };
        class RandomArtilleryComboBox: RscCombo
        {
            idc = 2100;
            x = 0.859297 * safezoneW + safezoneX;
            y = 0.276 * safezoneH + safezoneY;
            w = 0.132891 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
        };
        class BetterSoundsTitle: RscStructuredText
        {
            idc = 1103;
            text = "Better Sounds"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.318 * safezoneH + safezoneY;
            w = 0.147656 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Add in extra HUD sound elements that increase immersion.";
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                colorLink = "#D09B43";
                shadow = 1;
                size = 1;
            };
        };
        class BetterSoundsCheckBox: RscCheckbox
        {
            idc = 2800;
            x = 0.9725 * safezoneW + safezoneX;
            y = 0.318 * safezoneH + safezoneY;
            w = 0.0196875 * safezoneW;
            h = 0.028 * safezoneH;
        };
        class AmbientCombatTitle: RscStructuredText
        {
            idc = 1104;
            text = "Ambient Combat Sounds"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.388 * safezoneH + safezoneY;
            w = 0.147656 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Enable random explosions and firefights around the player(s) that are not real.";
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                colorLink = "#D09B43";
                shadow = 1;
                size = 1;
            };
        };
        class AmbientCombatCheckBox: RscCheckbox
        {
            idc = 2801;
            x = 0.9725 * safezoneW + safezoneX;
            y = 0.388 * safezoneH + safezoneY;
            w = 0.0196875 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
        };
        class RandomTimesTitle: RscStructuredText
        {
            idc = 1105;
            text = "Time"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.458 * safezoneH + safezoneY;
            w = 0.147656 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Choose a time for the scenario to start with.";
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                colorLink = "#D09B43";
                shadow = 1;
                size = 1;
            };
        };
        class RandomTimesComboBox: RscCombo
        {
            idc = 2101;
            x = 0.928204 * safezoneW + safezoneX;
            y = 0.458 * safezoneH + safezoneY;
            w = 0.0639844 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
        };
        class RandomWeatherTitle: RscStructuredText
        {
            idc = 1106;
            text = "Weather"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.528 * safezoneH + safezoneY;
            w = 0.147656 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Choose a weather for the scenario to start with.";
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                colorLink = "#D09B43";
                shadow = 1;
                size = 1;
            };
        };
        class RandomWeatherComboBox: RscCombo
        {
            idc = 2102;
            x = 0.928204 * safezoneW + safezoneX;
            y = 0.528 * safezoneH + safezoneY;
            w = 0.0639844 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
        };
        class DifficultyTitle: RscStructuredText
        {
            idc = 1107;
            text = "Difficulty"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.598 * safezoneH + safezoneY;
            w = 0.147656 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Choose a difficulty.";
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                colorLink = "#D09B43";
                shadow = 1;
                size = 1;
            };
        };
        class DifficultyComboBox: RscCombo
        {
            idc = 2103;
            x = 0.928204 * safezoneW + safezoneX;
            y = 0.598 * safezoneH + safezoneY;
            w = 0.0639844 * safezoneW;
            h = 0.028 * safezoneH;
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
        };
        class ChooseGroupComboBox: RscCombo
        {
            idc = 2104;
            x = 0.89375 * safezoneW + safezoneX;
            y = 0.766 * safezoneH + safezoneY;
            w = 0.0639844 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
        };
        class GroupChooseTitle: RscStructuredText
        {
            idc = 1101;
            text = "Select your group"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.71 * safezoneH + safezoneY;
            w = 0.142734 * safezoneW;
            h = 0.042 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            class Attributes
            {
                font = "PuristaLight";
                color = "#ffffff";
                align = "center";
                valign = "middle";
                shadow = false;
                shadowColor = "#000000";
                size = "1";
            };
        };
        class MenuTitle: RscStructuredText
        {
            idc = 1108;
            text = "SETTINGS"; 
            x = 0.854375 * safezoneW + safezoneX;
            y = 0.15 * safezoneH + safezoneY;
            w = 0.142734 * safezoneW;
            h = 0.07 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            class Attributes
            {
                font = "PuristaBold";
                color = "#ffffff";
                align = "center";
                valign = "middle";
                shadow = false;
                shadowColor = "#000000";
                size = "2";
            };
        };
        class OPFORComboBox: RscCombo
        {
            idc = 2106;
            x = 0.209609 * safezoneW + safezoneX;
            y = 0.29 * safezoneH + safezoneY;
            w = 0.1575 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
        };
        class INDEPComboBox: RscCombo
        {
            idc = 2105;
            x = 0.632891 * safezoneW + safezoneX;
            y = 0.29 * safezoneH + safezoneY;
            w = 0.1575 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
        };
        class BLUFORComboBox: RscCombo
        {
            idc = 2107;
            x = 0.42125 * safezoneW + safezoneX;
            y = 0.234 * safezoneH + safezoneY;
            w = 0.1575 * safezoneW;
            h = 0.028 * safezoneH;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
                style = ST_MULTI + ST_NO_RECT;
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
                shadow = 0;
                scrollSpeed = 0.06;
                width = 0;
                height = 0;
                autoScrollEnabled = 0;
                autoScrollSpeed = -1;
                autoScrollDelay = 5;
                autoScrollRewind = 0;
            };
            colorBackground[] = 
            {
                0,
                0,
                0,
                0.8
            };
        };
        class OPFORTitle: RscStructuredText
        {
            idc = 1102;
            text = "OPFOR GROUP"; 
            x = 0.209609 * safezoneW + safezoneX;
            y = 0.22 * safezoneH + safezoneY;
            w = 0.1575 * safezoneW;
            h = 0.07 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Choose a East faction.";
            class Attributes
            {
                font = "PuristaBold";
                color = "#ff0000";
                align = "center";
                valign = "middle";
                shadow = false;
                shadowColor = "#000000";
                size = "1.5";
            };
        };
        class BLUFORTitle: RscStructuredText
        {
            idc = 1109;
            text = "BLUFOR GROUP"; 
            x = 0.42125 * safezoneW + safezoneX;
            y = 0.164 * safezoneH + safezoneY;
            w = 0.1575 * safezoneW;
            h = 0.07 * safezoneH;
            colorBackground[] = {0,0,0,0};
            tooltip = "Choose a West faction.";
            class Attributes
            {
                font = "PuristaBold";
                color = "#00ffff";
                align = "center";
                valign = "middle";
                shadow = false;
                shadowColor = "#000000";
                size = "1.5";
            };
        };
        class INDEPTitle: RscStructuredText
        {
            idc = 1110;
            text = "INDEP GROUP"; 
            x = 0.632891 * safezoneW + safezoneX;
            y = 0.22 * safezoneH + safezoneY;
            w = 0.1575 * safezoneW;
            h = 0.07 * safezoneH;
            colorText[] = {1,1,1,1};
            colorBackground[] = {0,0,0,0};
            tooltip = "Choose a Independent faction.";
            class Attributes
            {
                font = "PuristaBold";
                color = "#00ff00";
                align = "center";
                valign = "middle";
                shadow = false;
                shadowColor = "#000000";
                size = "1.5";
            };
        };
    };
};

 

 

And here is my second file:
menu.sqf

Spoiler

// Create camera
_cam = "camera" camCreate (getPosATL arrow_cam_1);
_cam cameraEffect ["internal", "back"];
_cam camSetTarget arrow_cam_2;
_cam setDir 0;
_cam camSetFov 0.7;
_cam camSetFocus [-1,-1];
_cam camCommit 0;
waitUntil{camCommitted _cam};

createDialog "MenuScreen";

private _arrayRandomTimes =
[
	["Day", "Start at random day times."],
	["Night", "Start at random night times."],
	["Random", "Start at any random time."]
];

private _arrayRandomWeather =
[
	["Rain", "Weather is rain only."],
	["Foggy", "Weather is foggy only."],
	["Windy", "Weather is windy only."],
	["Random", "Weather occurs randomly."]
];

private _arrayRandomArt =
[
	0, 5, 10, 15, 20, 25, 30
];

private _arrayDifficulty =
[
	["Easy", "AI are dumb."],
	["Normal", "AI have default settings."],
	["Veteran", "AI are terminators."]
];

private _arrayGroups =
[
	["BLUFOR", "West faction."],
	["OPFOR", "East faction."],
	["INDEP", "Guerilla faction."]
];

private _allFactionClasses = "true" configClasses (configFile >> "CfgFactionClasses");
private _allOPFOR = [];
private _allBLUFOR = [];
private _allINDEP = [];

{
	private _factionName = configName _x;
	private _side = getNumber (configFile >> "CfgFactionClasses" >> _factionName >> "side");
	private _displayName = getText (configFile >> "CfgFactionClasses" >> _factionName >> "displayName");
	private _icon = getText (configFile >> "CfgFactionClasses" >> _factionName >> "icon");

	if(_displayName != "") then 
	{
		switch(_side) do 
		{
			case 0: { _allOPFOR pushBack [_displayName, _icon, _factionName]; };
			case 1: { _allBLUFOR pushBack [_displayName, _icon, _factionName]; };
			case 2: { _allINDEP pushBack [_displayName, _icon, _factionName]; };
		};
	};
} forEach _allFactionClasses;

private _ctrl = (findDisplay 0001) displayCtrl 2800;
_ctrl cbSetChecked true;
private _ctrl = (findDisplay 0001) displayCtrl 2801;
_ctrl cbSetChecked true;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2105;
	private _index = _ctrl lbAdd (_x select 0);
	_ctrl lbSetPicture [_index, (_x select 1)];
	_ctrl lbSetData [_index, (_x select 2)];
	_ctrl lbSetColor [_index, [0, 1, 0, 1]];
} forEach _allINDEP;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2106;
	private _index = _ctrl lbAdd (_x select 0);
	_ctrl lbSetPicture [_index, (_x select 1)];
	_ctrl lbSetData [_index, (_x select 2)];
	_ctrl lbSetColor [_index, [1, 0, 0, 1]];
} forEach _allOPFOR;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2107;
	private _index = _ctrl lbAdd (_x select 0);
	_ctrl lbSetPicture [_index, (_x select 1)];
	_ctrl lbSetData [_index, (_x select 2)];
	_ctrl lbSetColor [_index, [0, 1, 1, 1]];
} forEach _allBLUFOR; 

{
	private _ctrl = (findDisplay 0001) displayCtrl 2100;
	if(_x > 0) then {
		private _index = _ctrl lbAdd str _x + " minutes";
		lbSetTooltip [2100, _index, "Artillery occurs every " + str _x + " minutes."];
	} else {
		private _index = _ctrl lbAdd "No artillery";
		lbSetTooltip [2100, _index, "Random artillery is disabled"];
	};
} forEach _arrayRandomArt;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2101;
	private _index = _ctrl lbAdd (_x select 0);
	lbSetTooltip [2101, _index, (_x select 1)];
} forEach _arrayRandomTimes;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2102;
	private _index = _ctrl lbAdd (_x select 0);
	lbSetTooltip [2102, _index, (_x select 1)];
} forEach _arrayRandomWeather;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2103;
	private _index = _ctrl lbAdd (_x select 0);
	lbSetTooltip [2103, _index, (_x select 1)];
} forEach _arrayDifficulty;

{
	private _ctrl = (findDisplay 0001) displayCtrl 2104;
	private _index = _ctrl lbAdd (_x select 0);
	lbSetTooltip [2104, _index, (_x select 1)];
	switch((_x select 0)) do 
	{
		case "BLUFOR": { lbSetColor [2104, _index, [0,1,1,1]]; }; 
		case "OPFOR": { lbSetColor [2104, _index, [1,0,0,1]]; }; 
		case "INDEP": { lbSetColor [2104, _index, [0,1,0,1]]; }; 
	};
} forEach _arrayGroups;

lbSetCurSel [2105, 0];
lbSetCurSel [2106, 0];
lbSetCurSel [2107, 0];
lbSetCurSel [2100, 2];
lbSetCurSel [2101, 2];
lbSetCurSel [2102, 3];
lbSetCurSel [2103, 1];
lbSetCurSel [2104, 0];

private _ctrl = (findDisplay 0001) displayCtrl 2800;
_ctrl ctrlSetChecked true;
private _ctrl = (findDisplay 0001) displayCtrl 2801;
_ctrl ctrlSetChecked true;

waitUntil{!dialog};
_cam cameraEffect ["terminate", "back"];
camDestroy _cam;

 


Any help would be appreciated.

Edited by sizraide
Fixed

Share this post


Link to post
Share on other sites

NOTE:
I have to comment that some specific factions would actually work and the arrays would be filled out, but on other occassions it would be empty.

Share this post


Link to post
Share on other sites

FIXED:

 

I fixed it guys. If anyone wants to use this script for whatever purpose to gather all groups of factions and place them under each seperate category. Here it is:

 

Spoiler

private _side = "West"; // Test side
private _findFaction = "USA (SOCOM)"; // Test name
private _returnArray = []; // Return

private _allGroups = "getText (_x >> 'name') == _findFaction" configClasses (configFile >> "CfgGroups" >> _side);
private _factionName = configName (_allGroups select 0);

// Gather all types of factions under _findFaction 
private _allFactionGroups = []; 
{ 
	_allFactionGroups pushBack (configName _x); 
} forEach ("true" configClasses (configfile >> "CfgGroups" >> _side >> _factionName));

for "_i" from 0 to (count _allFactionGroups) - 1 do 
{
	// Get all groups under type of faction
	private _allGroupsUnderFaction = []; 
	private _selectedFaction = (_allFactionGroups select _i);
	{ 
		_allGroupsUnderFaction pushBack (configName _x); 
	} forEach ("true" configClasses (configfile >> "CfgGroups" >> _side >> _factionName >> _selectedFaction));

	_returnArray pushBack [_selectedFaction, _allGroupsUnderFaction]; 
};

hint str _returnArray;
copyToClipboard str _returnArray;
/*
[
	["Infantry",["BUS_InfSquad","BUS_InfSquad_Weapons","BUS_InfTeam","BUS_InfTeam_AT","BUS_InfTeam_AA","BUS_InfSentry","BUS_ReconTeam","BUS_ReconPatrol","BUS_ReconSentry","BUS_SniperTeam","BUS_InfAssault","BUS_ReconSquad","B_InfTeam_Light"]],
	["SpecOps",["BUS_DiverTeam","BUS_DiverTeam_Boat","BUS_DiverTeam_SDV","BUS_SmallTeam_UAV","BUS_ReconTeam_UGV","BUS_AttackTeam_UGV","BUS_ReconTeam_UAV","BUS_AttackTeam_UAV"]],
	["Support",["BUS_Support_CLS","BUS_Support_EOD","BUS_Support_ENG","BUS_Recon_EOD","BUS_Support_MG","BUS_Support_GMG","BUS_Support_Mort"]],
	["Motorized",["BUS_MotInf_Team","BUS_MotInf_AT","BUS_MotInf_AA","BUS_MotInf_MGTeam","BUS_MotInf_GMGTeam","BUS_MotInf_MortTeam","BUS_MotInf_Reinforce"]],
	["Mechanized",["BUS_MechInfSquad","BUS_MechInf_AT","BUS_MechInf_AA","BUS_MechInf_Support"]],
	["Armored",["BUS_TankPlatoon","BUS_TankPlatoon_AA","BUS_TankSection","BUS_SPGPlatoon_Scorcher","BUS_SPGSection_Scorcher","BUS_SPGSection_MLRS","B_TankDestrSection_Rhino","B_TankDestrSection_RhinoUP"]]
];
*/

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×