BIS fnc configViewer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(passed variable for the onSelect and onAdd params)
(filtered example with return)
Line 28: Line 28:


|x1= <code>[[call]] [[BIS_fnc_configViewer]];</code>
|x1= <code>[[call]] [[BIS_fnc_configViewer]];</code>
|x2= <code>[[private]] _return = [
[[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 accesories}}
}
) [[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>


|seealso= [[BIS_fnc_animViewer]], [[BIS_fnc_help]]
|seealso= [[BIS_fnc_animViewer]], [[BIS_fnc_help]]

Revision as of 13:01, 13 May 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
Diagnostic

Syntax

Syntax:
Syntax needed
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:
Return value needed

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 accesories } ) 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_animViewerBIS_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