diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index 9d6437495d..172a95808e 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_defaultValue", "_value", "_compiledConfigEntry"]; +private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_defaultValue", "_value", "_compiledConfigEntry", "_formatedValue"]; { /*_settingData = [ @@ -40,25 +40,39 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize if (GVAR(ClientSettingsExportIncluded) || !_isClientSetable) then { _value = missionNamespace getvariable [_name, _defaultValue]; - if (_typeName == "STRING") then { - _value = format['"%1"', _value]; - }; - if (_typeName == "BOOL") then { - _value = if (typeName _value == "BOOL" && {_value}) then {1} else {0}; + _formatedValue = switch (toLower _typeName) do { + case ("scalar"): { + format['value = %1;', _value]; + }; + case ("string"): { + format['value = "%1";', _value]; + }; + case ("bool"): { + if (typeName _value != "BOOL") then {ERROR("weird bool typename??");}; + _value = if (((typeName _value) == "BOOL") && {_value}) then {1} else {0}; + format ['value = %1;', _value]; + }; + case ("color"): { + _value params [["_r",1], ["_b",0], ["_g",1], ["_a",1]]; + format ["value[] = {%1, %2, %3, %4};", _r, _b, _g, _a]; + }; + default { + ERROR("unknown typeName"); + "" + }; + }; _compiledConfigEntry = format [" class %1 { - value = %2; + %2 typeName = %3; force = 1; -};", _name, _value, format['"%1"', _typeName]]; +};", _name, _formatedValue, format['"%1"', _typeName]]; "ace_clipboard" callExtension _compiledConfigEntry; }; } forEach EGVAR(common,settings); - "ace_clipboard" callExtension "--COMPLETE--"; +"ace_clipboard" callExtension "--COMPLETE--"; [LSTRING(settingsExported)] call EFUNC(common,displayTextStructured); - -