configProperties: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[[Cc]ategory:[ _]?Arma[ _]3:[ _]([^|]*)[ _]?\|.*\]\]" to "{{GameCategory|arma3|$1}}")
m (Some wiki formatting)
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command


| arma3 |Game name=
|game1= arma3
|version1= 1.36


|gr1= Config |GROUP1=
|gr1= Config


|1.36|Game version=
|descr= Returns an array of config entries which meet criteria in condition code. Command iterates through available classes and config properties for given config entry.
Current looked at config is stored in _x variable (similar to alternative [[count]] command implementation).
Condition has to return [[true]] in order for the looked at property to be added to the resulting array. This command is a bit slower than [[configClasses]] but allows to access inherited entries.


| Returns an array of config entries which meet criteria in condition code. Command iterates through available classes and config properties for given config entry. If 3rd param is [[true]] the search also includes inherited properties. Current looked at config is stored in _x variable (similar to alternative [[count]] command implementation). Condition has to return [[true]] in order for the looked at property to be added to the resulting array. A bit slower than [[configClasses]] but allows to access inherited entries.
|s1= [[configProperties]] [config, condition, inherit]
<br><br>{{Warning| The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more}}
{{Informative|With {{arma3}} 2.01.147002 the following conditions were optimised inside the engine:
* <tt>"true" </tt> (condition omitted)
* <tt>isClass _x</tt>
* <tt>isClass _x &&</tt> }}|DESCRIPTION=


| '''configProperties''' [config, condition, inherit] |SYNTAX=
|p1= config: [[Config]] - config entry to search


|p1= [config, condition, inherit]: [[Array]] |PARAMETER1=
|p2= condition: [[String]] - (Optional, default "true") expression, which if returns [[true]], adds current property to result
 
{{Feature|important|
|p2= config: [[Config]] - config entry to search|PARAMETER2=
* The condition code passed to [[configProperties]] should only be used for '''simple filter expressions''' and nothing more.
* Since {{GVI|arma3|2.02}} the following conditions are optimised for performance:
** {{hl|"true"}} (omitted condition)
** {{hl|"isClass _x"}}
** {{hl|"isClass _x &amp;&amp; (...)"}}
}}


|p3= condition (Optional): [[String]] - expression, which if returns [[true]], adds current property to result. Default: "[[true]]" |PARAMETER3=
|p3= inherit: [[Boolean]] - (Optional, default [[true]]) include inherited properties


|p4= inherit (Optional): [[Boolean]] - include inherited properties. Default: [[true]] |PARAMETER4=
|r1= [[Array]] - array of [[Config]]s


| [[Array]] - Array of [[Config]]s |RETURNVALUE=
|x1= <sqf>_configs = configProperties [configFile >> "CfgVehicles" >> "O_Truck_02_box_F"];</sqf>


|x1= <code>_configs = [[configProperties]] [<nowiki/>[[configFile]] >> "CfgVehicles" >> "O_Truck_02_box_F"];</code> |EXAMPLE1=
|x2= <sqf>_configs = configProperties [configFile >> "RscText", "true", true];</sqf>
 
|x2= <code>_configs = [[configProperties]] [<nowiki/>[[configFile]] >> "RscText", "[[true]]", [[true]]];</code> |EXAMPLE2=


|x3= Get all hitpoints of a truck:<code>_hitPoints = [];
|x3= Get all hitpoints of a truck:
_hitPointsCfgs = [[configProperties]] [
<sqf>
[[configFile]] >> "CfgVehicles" >> "O_Truck_02_box_F" >> "HitPoints",  
_hitPoints = [];
"[[true]]",  
_hitPointsCfgs = configProperties [
[[true]]
configFile >> "CfgVehicles" >> "O_Truck_02_box_F" >> "HitPoints",  
"true",  
true
];
];
[[hint]] [[str]] _hitPointsCfgs;</code> |EXAMPLE3=
hint str _hitPointsCfgs;
</sqf>


| [[Config]], [[configFile]], [[missionConfigFile]], [[configClasses]], [[configHierarchy]] |SEEALSO=
|seealso= [[Config]] [[configFile]] [[missionConfigFile]] [[configClasses]] [[configHierarchy]]
}}
}}
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|New_Scripting_Commands_List}}
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]

Latest revision as of 11:33, 8 April 2024

Hover & click on the images for description

Description

Description:
Returns an array of config entries which meet criteria in condition code. Command iterates through available classes and config properties for given config entry. Current looked at config is stored in _x variable (similar to alternative count command implementation). Condition has to return true in order for the looked at property to be added to the resulting array. This command is a bit slower than configClasses but allows to access inherited entries.
Groups:
Config

Syntax

Syntax:
configProperties [config, condition, inherit]
Parameters:
config: Config - config entry to search
condition: String - (Optional, default "true") expression, which if returns true, adds current property to result
  • The condition code passed to configProperties should only be used for simple filter expressions and nothing more.
  • Since Arma 3 logo black.png2.02 the following conditions are optimised for performance:
    • "true" (omitted condition)
    • "isClass _x"
    • "isClass _x && (...)"
inherit: Boolean - (Optional, default true) include inherited properties
Return Value:
Array - array of Configs

Examples

Example 1:
_configs = configProperties [configFile >> "CfgVehicles" >> "O_Truck_02_box_F"];
Example 2:
_configs = configProperties [configFile >> "RscText", "true", true];
Example 3:
Get all hitpoints of a truck:
_hitPoints = []; _hitPointsCfgs = configProperties [ configFile >> "CfgVehicles" >> "O_Truck_02_box_F" >> "HitPoints", "true", true ]; hint str _hitPointsCfgs;

Additional Information

See also:
Config configFile missionConfigFile configClasses configHierarchy

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note