BIS fnc configViewer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (Text replacement - "(\|p[0-9]+ *= *[^(]+\(Optional(, default[^)]*)\) )R([a-z])" to "$1r$3")
 
(52 intermediate revisions by 5 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.
*/


#define DIK_ESCAPE          0x01
|p2= cfg: [[Config]] - (Optional, default all configs) root config
#define DIK_1              0x02
#define DIK_2              0x03
#define DIK_3              0x04
#define DIK_4              0x05
#define DIK_5              0x06
#define DIK_6              0x07
#define DIK_7              0x08
#define DIK_8              0x09
#define DIK_9              0x0A
#define DIK_0              0x0B
#define DIK_MINUS          0x0C    /* - on main keyboard */
#define DIK_EQUALS          0x0D
#define DIK_BACK            0x0E    /* backspace */
#define DIK_TAB            0x0F
#define DIK_Q              0x10
#define DIK_W              0x11
#define DIK_E              0x12
#define DIK_R              0x13
#define DIK_T              0x14
#define DIK_Y              0x15
#define DIK_U              0x16
#define DIK_I              0x17
#define DIK_O              0x18
#define DIK_P              0x19
#define DIK_LBRACKET        0x1A
#define DIK_RBRACKET        0x1B
#define DIK_RETURN          0x1C    /* Enter on main keyboard */
#define DIK_LCONTROL        0x1D
#define DIK_A              0x1E
#define DIK_S              0x1F
#define DIK_D              0x20
#define DIK_F              0x21
#define DIK_G              0x22
#define DIK_H              0x23
#define DIK_J              0x24
#define DIK_K              0x25
#define DIK_L              0x26
#define DIK_SEMICOLON      0x27
#define DIK_APOSTROPHE      0x28
#define DIK_GRAVE          0x29    /* accent grave */
#define DIK_LSHIFT          0x2A
#define DIK_BACKSLASH      0x2B
#define DIK_Z              0x2C
#define DIK_X              0x2D
#define DIK_C              0x2E
#define DIK_V              0x2F
#define DIK_B              0x30
#define DIK_N              0x31
#define DIK_M              0x32
#define DIK_COMMA          0x33
#define DIK_PERIOD          0x34    /* . on main keyboard */
#define DIK_SLASH          0x35    /* / on main keyboard */
#define DIK_RSHIFT          0x36
#define DIK_MULTIPLY        0x37    /* * on numeric keypad */
#define DIK_LMENU          0x38    /* left Alt */
#define DIK_SPACE          0x39
#define DIK_CAPITAL        0x3A
#define DIK_F1              0x3B
#define DIK_F2              0x3C
#define DIK_F3              0x3D
#define DIK_F4              0x3E
#define DIK_F5              0x3F
#define DIK_F6              0x40
#define DIK_F7              0x41
#define DIK_F8              0x42
#define DIK_F9              0x43
#define DIK_F10            0x44
#define DIK_NUMLOCK        0x45
#define DIK_SCROLL          0x46    /* Scroll Lock */
#define DIK_NUMPAD7        0x47
#define DIK_NUMPAD8        0x48
#define DIK_NUMPAD9        0x49
#define DIK_SUBTRACT        0x4A    /* - on numeric keypad */
#define DIK_NUMPAD4        0x4B
#define DIK_NUMPAD5        0x4C
#define DIK_NUMPAD6        0x4D
#define DIK_ADD            0x4E    /* + on numeric keypad */
#define DIK_NUMPAD1        0x4F
#define DIK_NUMPAD2        0x50
#define DIK_NUMPAD3        0x51
#define DIK_NUMPAD0        0x52
#define DIK_DECIMAL        0x53    /* . on numeric keypad */
#define DIK_OEM_102        0x56    /* < > | on UK/Germany keyboards */
#define DIK_F11            0x57
#define DIK_NUMPADENTER    0x9C    /* Enter on numeric keypad */


#define DIK_DELETE          0xD3    /* Delete on arrow keypad */
|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


#define GUI_BACKGROUND (_display displayctrl 11000)
|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.
#define GUI_GROUPDEFAULT (_display displayctrl 2300)
#define GUI_GROUPCUSTOM (_display displayctrl 2301)
#define GUI_CLASSES (_display displayctrl 1500)
#define GUI_TITLE (_display displayctrl 1000)
#define GUI_CLASSES_SEARCH (_display displayctrl 1001)
#define GUI_PARAMS (_display displayctrl 1501)
#define GUI_PARAMS_SEARCH (_display displayctrl 1002)
#define GUI_BOOKMARKS (_display displayctrl 1502)
#define GUI_OK (_display displayctrl 2600)
#define GUI_CLOSE (_display displayctrl 2)
#define GUI_PREVIEWCLASS (_display displayctrl 2400)
#define GUI_PREVIEWPARAM (_display displayctrl 2401)
#define GUI_HIERARCHY (_display displayctrl 1400)
#define GUI_PARENTS (_display displayctrl 1401)
#define GUI_CUSTOMTEXT (_display displayctrl 1100)
#define GUI_CUSTOMBACKGROUND (_display displayctrl 1005)
#define INIT _display = uinamespace getvariable ["BIS_fnc_configviewer_display",displaynull];
//_display = (ctrlparent (_this select 0));


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|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.
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_configviewer]]; --> |= Syntax
|p6= header: [[String]] - (Optional, default "%1") custom header. Use %1 to refer to original name ("Splendid Config Viewer")


|p1= |= Parameter 1
|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.


| |= Return value
|x1= <sqf>call BIS_fnc_configViewer;</sqf>
____________________________________________________________________________________________


|x1= <code></code> |=  
|x2= <sqf>
____________________________________________________________________________________________
private _return = [
 
nil,
| |= See also
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>


|seealso= [[BIS_fnc_animViewer]] [[BIS_fnc_help]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[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}}]]

Latest revision as of 12: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