Maff 251 Posted December 15, 2019 I have been attempting to return a list of first and last names from the configs using the following; _fn = (configfile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "FirstNames"); _ln = (configfile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "LastNames"); Sadly I haven't had any luck as the list of names aren't in an array. I can return names if I already know the name which is... Infuriating! getText (configfile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "FirstNames" >> "aaron_baf") // "Aaron" - What a surprise!! Does anyone have a solution? 1 Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted December 16, 2019 To get an array from a config you'd need to use the proper command. getArray will return an array from the selected config entry, though not what you need in this case. You just need to iterate over all cfg entries within the desired hierarchy. Could look like this: _fn = []; _cfg = (configfile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "FirstNames"); for "_i" from 0 to ((count _cfg) - 1) do { _fn pushBack getText (_cfg select _i); }; _fn //returns ["Alfie","Benjamin","Callum"... etc. Cheers 1 2 Share this post Link to post Share on other sites
Maff 251 Posted December 16, 2019 @Grumpy Old Man You beauty! 1 1 Share this post Link to post Share on other sites
Larrow 2822 Posted December 17, 2019 _firstNames = configProperties[ configFile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "FirstNames", "isText( _x )", true ] apply{ getText( _x ) }; 3 1 Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted December 17, 2019 4 hours ago, Larrow said: _firstNames = configProperties[ configFile >> "CfgWorlds" >> "GenericNames" >> "NATOMen" >> "FirstNames", "isText( _x )", true ] apply{ getText( _x ) }; Well what do you know, this command even exists since 1.36... Spoiler Now I need to head into the cellar for further cargo cult programming rituals... Cheers 3 Share this post Link to post Share on other sites
johnnyboy 3797 Posted December 17, 2019 You gotta love Grump and Larrow (they should form a law firm: "Grump and Larrow"). Hey @Maff, I'm curious what your use case/need for the list of names is? 1 Share this post Link to post Share on other sites
Maff 251 Posted December 18, 2019 @johnnyboy A friend of mine wanted a scripting solution to retrieve a list of names Spanish names from CUP Units to assign to civilian agents spawned in progress. 3 Share this post Link to post Share on other sites
Larrow 2822 Posted December 18, 2019 On 12/17/2019 at 7:53 AM, Grumpy Old Man said: Well what do you know, this command even exists since 1.36 I always forget about it as well 😄 always use configClasses but always forget about this one. 1 Share this post Link to post Share on other sites