BIS fnc configViewer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|gr1 = Debug |GROUP1=" to "|gr1 = Diagnostic |GROUP1=")
m (Text replacement - "(\|p[0-9]+ *= *[^(]+\(Optional(, default[^)]*)\) )R([a-z])" to "$1r$3")
 
(39 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function|Comments=
{{RV|type=function
____________________________________________________________________________________________


| arma2oa |Game name=
|game1= arma2oa
|version1= 1.50


|1.00|Game version=
|game2= tkoh
|version2= 1.00


|gr1 = Diagnostic |GROUP1=
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| Splendid™ Config Viewer. |DESCRIPTION=
|gr1= Diagnostic
____________________________________________________________________________________________


| [parent, cfg, showOk, onSelect, onAdd, header] call [[BIS_fnc_configViewer]] |SYNTAX=
|descr= Opens the [[Arma 3: Splendid Config Viewer|Splendid™ Config Viewer]].


|p1= parent: [[Display]] - (Optional, default mission display) parent display |PARAMETER1=
|s1= [parent, cfg, showOk, onSelect, onAdd, header] call [[BIS_fnc_configViewer]]


|p2= cfg: [[Config]] - (Optional, default all configs) root config |PARAMETER2=
|p1= parent: [[Display]] - (Optional, default mission display) parent display


|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 |PARAMETER3=
|p2= cfg: [[Config]] - (Optional, default all configs) root config


|p4= onSelect: [[Code]] - (Optional, default {}) executed upon selecting a class. '''Must return [[String]]''', which will be shown as structured text instead of params. |PARAMETER4=
|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


|p5= onAdd: [[Code]] - (Optional, default {}) executed upon adding a class to list. Returned value (STRING) is item text. Empty string will skip the item. |PARAMETER5=
|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 {{hl|_this}} variable.


|p6= header: [[String]] - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer") |PARAMETER6=
|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 {{hl|_this}} variable.


| [[Array]]
|p6= header: [[String]] - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer")
* 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. |RETURNVALUE=
____________________________________________________________________________________________


|x1= <code>[[call]] [[BIS_fnc_configViewer]];</code> |EXAMPLE1=
|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.


| [[BIS_fnc_animViewer]], [[BIS_fnc_help]] |SEEALSO=
|x1= <sqf>call BIS_fnc_configViewer;</sqf>
}}


<h3 style="display:none">Notes</h3>
|x2= <sqf>
<dl class="command_description">
private _return = [
<!-- Note Section BEGIN -->
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];
</sqf>


<!-- Note Section END -->
|seealso= [[BIS_fnc_animViewer]] [[BIS_fnc_help]]
</dl>
}}
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Functions|{{uc:configViewer}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:configViewer}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:configViewer}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:configViewer}}]]

Latest revision as of 13:32, 8 November 2023

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