CBA_settings_fnc_init

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” or “COLOR” STRING
_titleDisplay name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
_categoryCategory for the settings menu STRING
_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) ARRAY
_scriptScript to execute when setting is changed.  (optional) <CODE>

Returns

_returnError code <NUMBER> 0: Success, no error 1: Failure, error

Examples

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

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

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

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

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

Author

commy2

string used by format
Array to read from [Array]
Close