-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class CfgFunctions { | ||
class CBA { | ||
class Settings { | ||
PATHTO_FNC(addSetting); | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_addSetting | ||
Description: | ||
Creates a new setting for that session. | ||
Parameters: | ||
_setting - Unique setting name. Matches resulting variable name <STRING> | ||
_settingType - Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING> | ||
_title - Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY> | ||
_category - Category for the settings menu + optional sub-category <STRING, ARRAY> | ||
_valueInfo - Extra properties of the setting depending of _settingType. See examples below <ANY> | ||
_isGlobal - 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) <ARRAY> | ||
_script - Script to execute when setting is changed. (optional) <CODE> | ||
_needRestart - Setting will be marked as needing mission restart after being changed. (optional, default false) <BOOL> | ||
Returns: | ||
_return - Error code <BOOLEAN> | ||
true: Success, no error | ||
false: Failure, error | ||
Examples: | ||
(begin example) | ||
// 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] | ||
["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; | ||
(end) | ||
Author: | ||
commy2 | ||
---------------------------------------------------------------------------- */ | ||
|
||
call (uiNamespace getVariable QFUNC(init)) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters