{"name":"BIS_fnc_configViewer","operator":null,"title":"BIS fnc configViewer","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_configViewer","revid":348118,"updated":"2023-11-08T11:32:17Z","groups":["Diagnostic"],"status":"ok","replaced_by":[],"games":[{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Opens the Splendid™ Config Viewer.","syntaxes":[{"syntax":"[parent, cfg, showOk, onSelect, onAdd, header] call BIS_fnc_configViewer","since":null,"effect":null,"exec":null,"params":[{"name":"parent","type":"Display","optional":true,"default":"mission display","description":"parent display","types":["Display"],"since":null,"text":"parent: Display - (Optional, default mission display) parent display"},{"name":"cfg","type":"Config","optional":true,"default":"all configs","description":"root config","types":["Config"],"since":null,"text":"cfg: Config - (Optional, default all configs) root config"},{"name":"showOk","type":"Boolean","optional":true,"default":"false","description":"true to display OK button. Script will then wait until viewer is closed and return selected class and param","types":["Boolean"],"since":null,"text":"showOk: Boolean - (Optional, default false) true to display OK button. Script will then wait until viewer is closed and return selected class and param"},{"name":"onSelect","type":"Code","optional":true,"default":"{}","description":"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.","types":["Code"],"since":null,"text":"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."},{"name":"onAdd","type":"Code","optional":true,"default":"{}","description":"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.","types":["Code"],"since":null,"text":"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."},{"name":"header","type":"String","optional":true,"default":"\"%1\"","description":"custom header. Use %1 to refer to original name (\"Splendid Config Viewer\")","types":["String"],"since":null,"text":"header: String - (Optional, default \"%1\") custom header. Use %1 to refer to original name (\"Splendid Config Viewer\")"}],"returns":{"type":"Array","types":["Array"],"description":"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.","text":"Array\n- When OK button is not displayed, empty array is returned\n- Else, an array of currently selected entries in format [class (Config), param (String)] is returned."}}],"examples":[{"text":"```sqf\ncall BIS_fnc_configViewer;\n```","code":["call BIS_fnc_configViewer;"]},{"text":"```sqf\nprivate _return = [\n    nil,\n    configFile >> \"CfgWeapons\",\n    true,\n    nil,\n    {\n        params [\"_cfg\"];\n        if (\n            getNumber(_cfg >> \"scope\") == 2 &&\n            { // Layzy evaluation\n                getNumber(_cfg >> \"type\") in [1,2,4] && // primary, secondary, handgun weapons\n                { !isClass (_cfg >> \"LinkedItems\") or getText(_cfg >> \"baseWeapon\") == configName _cfg } // only base weapons, no accessories\n            }\n        ) exitWith {\n            [_cfg] call BIS_fnc_displayName; // add the weapon with its displayname\n        };\n        \"\" // don't add\n    },\n    \"Select Weapon\"\n] call BIS_fnc_configViewer;\n_cfgSelected = _return param [0, configNull];\nsystemChat str [configName _cfgSelected, _cfgSelected];\n```","code":["private _return = [\n\tnil,\n\tconfigFile >> \"CfgWeapons\",\n\ttrue,\n\tnil,\n\t{\n\t\tparams [\"_cfg\"];\n\t\tif (\n\t\t\tgetNumber(_cfg >> \"scope\") == 2 &&\n\t\t\t{ // Layzy evaluation\n\t\t\t\tgetNumber(_cfg >> \"type\") in [1,2,4] && // primary, secondary, handgun weapons\n\t\t\t\t{ !isClass (_cfg >> \"LinkedItems\") or getText(_cfg >> \"baseWeapon\") == configName _cfg } // only base weapons, no accessories\n\t\t\t}\n\t\t) exitWith {\n\t\t\t[_cfg] call BIS_fnc_displayName; // add the weapon with its displayname\n\t\t};\n\t\t\"\" // don't add\n\t},\n\t\"Select Weapon\"\n] call BIS_fnc_configViewer;\n_cfgSelected = _return param [0, configNull];\nsystemChat str [configName _cfgSelected, _cfgSelected];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_animViewer","BIS_fnc_help"],"notes":[],"categories":["Arma 2: Operation Arrowhead: Functions","Arma 2: Operation Arrowhead: New Functions","Arma 3: Functions","Function Group: Diagnostic","Functions","Introduced with Arma 2: Operation Arrowhead version 1.50","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}