Skip to content

Instantly share code, notes, and snippets.

@Grezvany13
Last active September 20, 2016 21:06
Show Gist options
  • Save Grezvany13/fefae80ecb17e3cf826f5520c4b1d732 to your computer and use it in GitHub Desktop.
Save Grezvany13/fefae80ecb17e3cf826f5520c4b1d732 to your computer and use it in GitHub Desktop.
ArmA 3 - @CBA_A3 - CBA Settings Framework

How to use the CBA Settings Framework in your own mod

  1. Include your own "script_component.hpp" in the "config.cpp" of your addon

see script_macros_common.hpp for more information

  1. Add the Extended_PreInit_EventHandlers class to your "config.cpp" (see example for full code)

  2. Create a "XEH_preInit.hpp" file

  3. Add the settings for your mod by calling the cba_settings_fnc_init function (see example)

see fnc_init.sqf for more detailed information about this function

IMPORTANT

Due limitations of the Event Handlers of CBA (which is an issue with the ArmA 3 engine), it's required to pre-load a world while starting the game. This means it's not possible to use the -world=empty parameter.

#include "script_component.hpp"
// CfgPatches (required, for every addon)
class CfgPatches
{
class ADDON
{
// your addon config
}
}
// CfgMods (optional, only once per mod required)
class CfgMods
{
class PREFIX
{
// your mod config
}
}
// Extended_PreInit_EventHandlers (required, must run at PreInit)
class Extended_PreInit_EventHandlers
{
class ADDON
{
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
["Test_Setting_1", "CHECKBOX", ["-test checkbox-", "-tooltip-"], "My Category", true] call cba_settings_fnc_init;
["Test_Setting_2", "LIST", ["-test list-", "-tooltip-"], "My Category", [[1,0], ["enabled","disabled"], 1]] call cba_settings_fnc_init;
["Test_Setting_3", "SLIDER", ["-test slider-", "-tooltip-"], "My Category", [0, 10, 5, 0]] call cba_settings_fnc_init;
["Test_Setting_4", "COLOR", ["-test color-", "-tooltip-"], "My Category", [1,1,0], false, {diag_log text format ["Color Setting Changed: %1", _this];}] call cba_settings_fnc_init;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment