BIS fnc configViewer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - "<code>(\[[a-zA-Z0-9_, ]*\] )?\[\[(call|spawn)\]\] \[\[(BI[NS]\_fnc\_[a-zA-Z0-9_]+)\]\];?<\/code>" to "<sqf>$1$2 $3;</sqf>")
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2oa
____________________________________________________________________________________________
|version1= 1.50


| arma2oa |= Game name
|game2= tkoh
|version2= 1.00


|1.00|= Game version
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| <pre>/*
|gr1= Diagnostic


Description:
|descr= Opens the [[Arma 3: Splendid Config Viewer|Splendid&trade; Config Viewer]].
Splendid config viewer


Parameter(s):
|s1= [parent, cfg, showOk, onSelect, onAdd, header] call [[BIS_fnc_configViewer]]
0 (Optional): DISPLAY - parent display (mission display by default)
1 (Optional): CONFIG - root config (all configs displayed by default)
2 (Optional): BOOL - true to display OK button. Script will then wait until viewer is closed and return selected class and param
3 (Optional): CODE - executed upon selecting a class. Has to return STRING, which will be shown as structured text instead of params.
3 (Optional): CODE - executed upon adding a class to list. Returned value (STRING) is item text. Empty string will skip the item.
5 (Optional): TEXT - custom header. Use %1 to refer to original name ("Splendid Config Viewer")


Returns:
|p1= parent: [[Display]] - (Optional, default mission display) parent display
ARRAY
- when OK button is not displayed, empty array is returned
- when OK button is displayed, array of currently selected entries in format [class (CONFIG), param (STRING)] is returned.
*/
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_configviewer]]; --> |= Syntax
|p2= cfg: [[Config]] - (Optional, default all configs) Root config


|p1= |= Parameter 1
|p3= showOk: [[Boolean]] - (Optional, default [[false]]) [[true]] to display OK button. Script will then wait until viewer is closed and return selected class and param


| |= Return value
|p4= onSelect: [[Code]] - (Optional, default {}) executed upon selecting a class. '''Must return [[String]]''', which will be shown as structured text instead of params. Currently evaluated config is passed in the {{ic|_this}} variable.
____________________________________________________________________________________________


|x1= <code></code> |=
|p5= onAdd: [[Code]] - (Optional, default {}) executed upon adding a class to list. Returned value (STRING) is item text. Empty string will skip the item. Currently evaluated config is passed in the {{ic|_this}} variable.
____________________________________________________________________________________________


| |= See also
|p6= header: [[String]] - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer")


}}
|r1= [[Array]]
* When OK button is not displayed, empty array is returned
* Else, an array of currently selected entries in format [class ([[Config]]), param ([[String]])] is returned.


<h3 style="display:none">Notes</h3>
|x1= <sqf>call BIS_fnc_configViewer;</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x2= <code>[[private]] _return = [
</dl>
[[nil]],
[[configFile]] >> "CfgWeapons",
[[true]],
[[nil]],
{
[[params]] ["_cfg"];
[[if]] (
[[getNumber]](_cfg >> "scope") == 2 &&
{ {{cc|Layzy evaluation}}
[[getNumber]](_cfg >> "type") [[in]] [1,2,4] && {{cc|primary, secondary, handgun weapons}}
{ ![[isClass]] (_cfg >> "LinkedItems") [[or]] [[getText]](_cfg >> "baseWeapon") == [[configName]] _cfg } {{cc|only base weapons, no accessories}}
}
) [[exitWith]] {
[_cfg] [[call]] [[BIS_fnc_displayName]]; {{cc|add the weapon with its displayname}}
};
"" {{cc|don't add}}
},
"Select Weapon"
] [[call]] [[BIS_fnc_configViewer]];
_cfgSelected = _return [[param]] [0, [[configNull]]];
[[systemChat]] [[str]] [<nowiki/>[[configName]] _cfgSelected, _cfgSelected];</code>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[BIS_fnc_animViewer]] [[BIS_fnc_help]]
[[Category:Function Group: Debug|{{uc:configviewer}}]]
}}
[[Category:Functions|{{uc:configviewer}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:configviewer}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:configviewer}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:configviewer}}]]

Revision as of 14:04, 5 May 2022

Hover & click on the images for description

Description

Description:
Opens the Splendid™ Config Viewer.
Execution:
call
Groups:
Diagnostic

Syntax

Syntax:
[parent, cfg, showOk, onSelect, onAdd, header] call BIS_fnc_configViewer
Parameters:
parent: Display - (Optional, default mission display) parent display
cfg: Config - (Optional, default all configs) Root config
showOk: Boolean - (Optional, default false) true to display OK button. Script will then wait until viewer is closed and return selected class and param
onSelect: Code - (Optional, default {}) executed upon selecting a class. Must return String, which will be shown as structured text instead of params. Currently evaluated config is passed in the _this variable.
onAdd: Code - (Optional, default {}) executed upon adding a class to list. Returned value (STRING) is item text. Empty string will skip the item. Currently evaluated config is passed in the _this variable.
header: String - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer")
Return Value:
Array
  • When OK button is not displayed, empty array is returned
  • Else, an array of currently selected entries in format [class (Config), param (String)] is returned.

Examples

Example 1:
call BIS_fnc_configViewer;
Example 2:
private _return = [ nil, configFile >> "CfgWeapons", true, nil, { params ["_cfg"]; if ( getNumber(_cfg >> "scope") == 2 && { // Layzy evaluation getNumber(_cfg >> "type") in [1,2,4] && // primary, secondary, handgun weapons { !isClass (_cfg >> "LinkedItems") or getText(_cfg >> "baseWeapon") == configName _cfg } // only base weapons, no accessories } ) exitWith { [_cfg] call BIS_fnc_displayName; // add the weapon with its displayname }; "" // don't add }, "Select Weapon" ] call BIS_fnc_configViewer; _cfgSelected = _return param [0, configNull]; systemChat str [configName _cfgSelected, _cfgSelected];

Additional Information

See also:
BIS_fnc_animViewer BIS_fnc_help

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