CBA_fnc_addSetting

Description

Creates a new setting for that session.

Parameters

_settingUnique setting name.  Matches resulting variable name STRING
_settingTypeType of setting.  Can be “CHECKBOX”, “EDITBOX”, “LIST”, “SLIDER”, “COLOR” or “TIME” STRING
_titleDisplay name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
_categoryCategory for the settings menu + optional sub-category <STRING, ARRAY>
_valueInfoExtra properties of the setting depending of _settingType.  See examples below <ANY>
_isGlobal1: all clients share the same setting, 2: setting can’t be overwritten (optional, default: 0) <BOOL, NUMBER>
_scriptScript to execute when setting is changed.  (optional) <CODE>
_needRestartSetting will be marked as needing mission restart after being changed.  (optional, default false) <BOOL>

Returns

_returnError code <BOOLEAN> true: Success, no error false: Failure, error

Examples

// CHECKBOX --- extra argument: default value
["Test_Setting_1", "CHECKBOX", ["-test checkbox-", "-tooltip-"], "My Category", true] call CBA_fnc_addSetting;

// LIST --- extra arguments: [_values, _valueTitles, _defaultIndex]
["Test_Setting_2", "LIST",     ["-test list-",     "-tooltip-"], "My Category", [[1, 0], ["enabled","disabled"], 1]] call CBA_fnc_addSetting;

// SLIDER --- extra arguments: [_min, _max, _default, _trailingDecimals, _isPercentage]
["Test_Setting_3", "SLIDER",   ["-test slider-",   "-tooltip-"], "My Category", [0, 10, 5, 0]] call CBA_fnc_addSetting;

// COLOR PICKER --- extra argument: _color
["Test_Setting_4", "COLOR",    ["-test color-",    "-tooltip-"], "My Category", [1, 1, 0]] call CBA_fnc_addSetting;

// EDITBOX --- extra argument: default value
["Test_Setting_5", "EDITBOX",  ["-test editbox-", "-tooltip-"], "My Category", "defaultValue"] call CBA_fnc_addSetting;

// TIME PICKER (time in seconds) --- extra arguments: [_min, _max, _default]
["Test_Setting_6", "TIME",     ["-test time-",    "-tooltip-"], "My Category", [0, 3600, 60]] call CBA_fnc_addSetting;

Author

commy2

string used by format
Close