Jump to content

Recommended Posts

Good afternoon,

I am trying to find information regarding the automatic navigation of the config file. So far I have been doing it 'by hand' by specifying the values in a list of Strings, for example:

    [configfile >> "CfgGroups" >> "East" >> "rhs_faction_vdv" >> "rhs_group_rus_vdv_mi24" >> "rhs_group_rus_vdv_mi24_squad_mg_sniper",0],
    [configfile >> "CfgGroups" >> "East" >> "rhs_faction_vdv" >> "rhs_group_rus_vdv_mi8" >> "rhs_group_rus_vdv_mi8_squad",0],


These values are taken from the editor and pasted into the list. I am wondering if it were possible to navigate the config file and obtain those values directly from the script.


Thanks in advance.

Share this post

Link to post
Share on other sites

Any code example that put me on the right way? The documentation is pretty complex. I wish I knew how to get all the possible groups of a given side of the mods installed. In this case it is RHS, but I would be great if CUPS was detected and the strings indicating the path for its groups were generated by code.



Share this post

Link to post
Share on other sites

The comment examples in that wiki link are a pretty good start to understand the idea on how it can be done.

Share this post

Link to post
Share on other sites

They are, but i still remember when this was all a foreign language to me (lack of knowledge + ambitions 😓).


@Captain Horny There's some topics out there about getting config entries, and even groups, that also come with examples. Have a search of those and if you want, check the wiki for each of the commands to understand them. I can actually get all EAST RHS groups by their name easily enough, but tbh I ran out of time turning them into config entries that could be used, for example, with BIS_fnc_spawnGroup.

Share this post

Link to post
Share on other sites

I created my own function for that but it's not usable as is.

Anyway, as you can see in config viewer, you have several kinds of CONFIGS:


cfgFactionClasses like...  configfile >> "CfgFactionClasses" >> "BLU_CTRG_F"

So you can extract its flag by: getText (configfile >> "CfgFactionClasses" >> "BLU_CTRG_F" >> "flag")  // returns : "\a3\Data_F_Exp\Flags\flag_CTRG_CO.paa"


cfgGroups like... configfile >> "CfgGroups" >> "West" >> "BLU_CTRG_F" >> "Motorized" >> "CTRG_MotInf_AssaultTeam"

the units (type) of this group can be grabbed by:

"true" configClasses (configfile >> "CfgGroups" >> "West" >> "BLU_CTRG_F" >> "Infantry" >> "B_CTRG_InfTeam_Light") apply {getText (_x >> "vehicle")};

// returns: ["B_T_LSV_01_armed_CTRG_F","B_CTRG_Soldier_Medic_tna_F","B_CTRG_Soldier_M_tna_F","B_CTRG_Soldier_AR_tna_F","B_CTRG_Soldier_LAT_tna_F"]



You can also grab the rank or the relative position:

"true" configClasses (configfile >> "CfgGroups" >> "West" >> "BLU_CTRG_F" >> "Infantry" >> "B_CTRG_InfTeam_Light") apply {getText (_x >> "rank")};

"true" configClasses (configfile >> "CfgGroups" >> "West" >> "BLU_CTRG_F" >> "Infantry" >> "B_CTRG_InfTeam_Light") apply {getArray (_x >> "position")};

(Just to introduce getArray. See also getNumber for extracting the side number, or some configs if you want to extract the full rounds of a magazine or something like that...)



Have a look at the config viewer! The cfgGroups is always done like this:

configFile >> "cfgGroups"

>>  string of side

>>  a faction name (sometimes missing in cfgFactions for some mods!)

>> a category of group  (string) That's the hardest sub-class to cope with, because, when a mod is "compliant" you can read: "infantry", "motorized", "armored", "mechanized", "specops"... Even Arma is not really formatted for that ("Motorized_MTP", ugh? what's the need?)
CUP is rather OK. RHS not at all:
"rhs_group_rus_vdv_mi8" ??

>> then the group itself

>> the sub-class like unit0, unit1, unit2...  (and this is common for all mods).


So, extracting all west groups needs... a script with:

_allWestFactions = "true" configClasses (configfile >> "CfgGroups" >> "West");

then all the categories:

_allWestCatGroups = [];
{{_allWestCatGroups pushBackUnique configName _x} forEach ("true" configClasses _x)} forEach _allWestFactions;

then the groups:

_allWestGroups = [];  // I leave it in their config names but you can apply configName _x on them to get their string name.

{_fac = _x; {_allWestGroups pushBack ("true" configClasses (_fac >> _x))} forEach _allWestCatGroups} forEach _allWestFactions;


And, for RHS only, filter the factions:

replace everywhere _allWestFactions by:

_allRHSWestFactions =  " 'rhs' in toLowerAnsi (configName _x)" configClasses (configfile >> "CfgGroups" >> "West");

Note: you could filter the CatGroups also, and even the groups as RHS is stringed everywhere. Not sure that worth it if you extract that stuff at the start of the game.






  • Like 1

Share this post

Link to post
Share on other sites

Thank you very much indeed @beno_83au and @pierremgi. That is exactly what I am trying to achieve, to make it work as a call to BIS_fnc_spawnGroup.

  • Like 1

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