BIS fnc configViewer: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "= <code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-_]+)\]\]([^<]*)<\/code>" to "= <code>$1$2$3</code>") |
Lou Montana (talk | contribs) m (Text replacement - "(\|p[0-9]+ *= *[^(]+\(Optional(, default[^)]*)\) )R([a-z])" to "$1r$3") |
||
(17 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
|p1= parent: [[Display]] - (Optional, default mission display) parent display | |p1= parent: [[Display]] - (Optional, default mission display) parent display | ||
|p2= cfg: [[Config]] - (Optional, default all configs) | |p2= cfg: [[Config]] - (Optional, default all configs) root config | ||
|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 | |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 | ||
|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 {{ | |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. | ||
|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 {{ | |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. | ||
|p6= header: [[String]] - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer") | |p6= header: [[String]] - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer") | ||
Line 34: | Line 34: | ||
|x1= <sqf>call BIS_fnc_configViewer;</sqf> | |x1= <sqf>call BIS_fnc_configViewer;</sqf> | ||
|x2= < | |x2= <sqf> | ||
private _return = [ | |||
nil, | |||
configFile >> "CfgWeapons", | |||
true, | |||
nil, | |||
{ | { | ||
params ["_cfg"]; | |||
if ( | |||
getNumber(_cfg >> "scope") == 2 && | |||
{ // Layzy evaluation | { // 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] | [_cfg] call BIS_fnc_displayName; // add the weapon with its displayname | ||
}; | }; | ||
"" // don't add | "" // don't add | ||
}, | }, | ||
"Select Weapon" | "Select Weapon" | ||
] | ] call BIS_fnc_configViewer; | ||
_cfgSelected = _return | _cfgSelected = _return param [0, configNull]; | ||
systemChat str [configName _cfgSelected, _cfgSelected]; | |||
</sqf> | |||
|seealso= [[BIS_fnc_animViewer]] [[BIS_fnc_help]] | |seealso= [[BIS_fnc_animViewer]] [[BIS_fnc_help]] | ||
}} | }} |
Latest revision as of 12:32, 8 November 2023
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
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