ACE3/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf

51 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-04-05 00:17:43 +00:00
/*
* Author: Glowbal
* Called when the listbox selection is changed for an options (eg: chaning a setting from false to true)
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_onListBoxSettingsChanged
*
* Public: No
*/
#include "script_component.hpp"
2015-04-17 00:46:42 +00:00
private ["_settingIndex", "_inputText", "_setting", "_settingName", "_convertedValue"];
2015-04-05 00:17:43 +00:00
_inputText = ctrlText 414; //Index of right drop down
_settingIndex = -1;
2015-08-11 09:15:55 +00:00
if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then {
_settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]];
};
2015-04-05 00:17:43 +00:00
switch (GVAR(optionMenu_openTab)) do {
2015-04-05 00:33:45 +00:00
case (MENU_TAB_SERVER_VALUES): {
2015-04-17 00:46:42 +00:00
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideValues)))) then {
try {
_setting = (GVAR(serverSideValues) select _settingIndex);
_settingName = _setting select 0;
2015-04-05 00:17:43 +00:00
2015-04-17 00:46:42 +00:00
_convertedValue = switch (toUpper (_setting select 1)) do {
case "STRING": {
ctrlSetText [414, _inputText call FUNC(stringEscape)];
format ['%1', _inputText call FUNC(stringEscape)];
};
2015-04-05 00:33:45 +00:00
case "ARRAY": {format [call compile "[%1]", _inputText]};
case "SCALAR": {parseNumber _inputText;};
2015-04-17 00:46:42 +00:00
default {throw "Error"};
};
[MENU_TAB_SERVER_VALUES, _settingName, _convertedValue] call FUNC(updateSetting);
} catch {
2015-04-05 00:33:45 +00:00
};
};
2015-04-17 00:46:42 +00:00
[false] call FUNC(serverSettingsMenuUpdateList);
2015-04-05 00:33:45 +00:00
};
2015-04-05 00:17:43 +00:00
};