Difference between revisions of "configFile"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (<pre> to <code>)
Line 26: Line 26:
 
<dl class="command_description">
 
<dl class="command_description">
 
<!-- Note Section BEGIN -->
 
<!-- Note Section BEGIN -->
 
+
<dd class="notedate">Posted on Apr 3, 2014 - 00:37
 +
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note">
 +
In ArmA3 ver 1.14 there’re several comfortable workarounds with [[configFile]] for collecting subclasses. As for traditional workaround like:
 +
<code>
 +
(configfile >> "CfgFaces") call {
 +
  private ["_classes"];
 +
  _classes = [];
 +
  for "_i" from 0 to ((count _this) - 1) do 
 +
  {
 +
    if (isClass (_this select _i)) then
 +
  {
 +
  _classes set [count _classes, configName (_this select _i)];
 +
  };
 +
  };
 +
  _classes
 +
};
 +
//return: ["Default"……"O_Colonel"] 8 items
 +
</code>
 +
Alternative recommended workaround by using: [[BIS_fnc_getCfgSubClasses]] e.g.
 +
<code>
 +
(configfile >> "CfgFaces") call BIS_fnc_getCfgSubClasses
 +
//Same as traditional workaround
 +
</code>
 +
Another powerful replacement is using [[BIS_fnc_returnChildren]] to collect grandchildren classes with desired level, e.g.
 +
<code>
 +
[(configfile >> "CfgFaces"),1,true,true] call BIS_fnc_returnChildren;
 +
//Return all children faces with a total number at 68
 +
</code>
 +
And as for another advanced workaround for direct processing collected classes, use [[BIS_fnc_uniqueClasses]]. E.g.
 +
<code>
 +
my_array = [];
 +
[(configfile >> "BombCrater"),{my_array set [count my_array,(_this select 2) call bis_fnc_getcfgdata]}] call BIS_fnc_uniqueClasses;
 +
//return [[0,0,0],[0,0,0],[0,0,0]]
 +
</code>
 
<!-- Note Section END -->
 
<!-- Note Section END -->
 
</dl>
 
</dl>

Revision as of 18:38, 2 April 2014

Introduced with Armed Assault version 1.001.00
Hover & click on the images for descriptions

Description

Description:
Return root of config entries hierarchy.
See AllInOne Config for a full config extract as example.

Syntax

Syntax:
Config = configFile
Return Value:
Config

Examples

Example 1:
_isMyClassActive = isClass (configFile / "CfgPatches" / "MyClass");

Additional Information

See also:
missionConfigFilecampaignConfigFileconfig/nameconfig >> nameconfigNamecountgetArraygetTextgetNumberinheritsFromisArrayisClassisNumberisTextselect

Notes

i
Only post proven facts here. Report bugs on the feedback tracker. Use the Talk page or the Forums for discussions.

Notes

Posted on Apr 3, 2014 - 00:37
ffur2007slx2_5
In ArmA3 ver 1.14 there’re several comfortable workarounds with configFile for collecting subclasses. As for traditional workaround like: (configfile >> "CfgFaces") call { private ["_classes"]; _classes = []; for "_i" from 0 to ((count _this) - 1) do { if (isClass (_this select _i)) then { _classes set [count _classes, configName (_this select _i)]; }; }; _classes }; //return: ["Default"……"O_Colonel"] 8 items Alternative recommended workaround by using: BIS_fnc_getCfgSubClasses e.g. (configfile >> "CfgFaces") call BIS_fnc_getCfgSubClasses //Same as traditional workaround Another powerful replacement is using BIS_fnc_returnChildren to collect grandchildren classes with desired level, e.g. [(configfile >> "CfgFaces"),1,true,true] call BIS_fnc_returnChildren; //Return all children faces with a total number at 68 And as for another advanced workaround for direct processing collected classes, use BIS_fnc_uniqueClasses. E.g. my_array = []; [(configfile >> "BombCrater"),{my_array set [count my_array,(_this select 2) call bis_fnc_getcfgdata]}] call BIS_fnc_uniqueClasses; //return [[0,0,0],[0,0,0],[0,0,0]]

Bottom Section