Skip to content

MCM_Config

github-actions[bot] edited this page Jul 19, 2026 · 1 revision

A helper class to create the MCM Config file to be registered with MCM

Description

Provides methods to easily create and store all available MCM value types. The stored values can then be used to generate a config file and register your mod with MCM.

Properties

Type Name Default Value
String FilePath "user://MCM//"
String ModID ""
String FriendlyName ""
String Description ""
Variant FileOnSaveCallback null
Object CallbackObject null
Dictionary CreatedValues {}

Constructors

Return Value Parameters
MCM_Config MCM_Config(modId: String, modFriendlyName: String, modDescription: String, fileOnSaveCallback: Variant, callbackObject: Object)

Methods

Return Value Name and Parameters
void RegisterMod() const
ConfigFile CreateConfigFile() const
MCM_Category CreateCategoryHeader(id: String, name: String)
MCM_String CreateStringValue(id: String, name: String, tooltip: String, default: String)
MCM_Int CreateIntValue(id: String, name: String, tooltip: String, default: int)
MCM_Float CreateFloatValue(id: String, name: String, tooltip: String, default: float)
MCM_Bool CreateBoolValue(id: String, name: String, tooltip: String, default: bool)
MCM_Keycode CreateKeycodeValue(id: String, name: String, tooltip: String, default: Key, defaultType: MCM_Key_Types)
MCM_Color CreateColorValue(id: String, name: String, tooltip: String, default: Color)
MCM_Dropdown CreateDropdownValue(id: String, name: String, tooltip: String, default: String, options: Dictionary)
MCM_Vector2 CreateVector2Value(id: String, name: String, tooltip: String, default: Vector2)
MCM_Vector3 CreateVector3Value(id: String, name: String, tooltip: String, default: Vector3)
MCM_Array CreateArrayValue(id: String, name: String, tooltip: String, default: Array, valueType: MCM_Collection_Types, defaultItemValue: String | int | float | bool | Color | Vector2 | Vector3)
MCM_Dictionary CreateDictionaryValue(id: String, name: String, tooltip: String, default: Dictionary, valueType: MCM_Collection_Types, defaultItemValue: Dictionary)

Enumerations

enum MCM_Collection_Types:

MCM_Collection_Types STRING = 0

  Sets an MCM_Array or MCM_Dictionary to accept String value types

MCM_Collection_Types INT = 1

  Sets an MCM_Array or MCM_Dictionary to accept int value types

MCM_Collection_Types FLOAT = 2

  Sets an MCM_Array or MCM_Dictionary to accept Float value types

MCM_Collection_Types BOOLEAN = 3

  Sets an MCM_Array or MCM_Dictionary to accept bool value types

MCM_Collection_Types COLOR = 4

  Sets an MCM_Array or MCM_Dictionary to accept Color value types

MCM_Collection_Types VECTOR2 = 5

  Sets an MCM_Array or MCM_Dictionary to accept Vector2 value types

MCM_Collection_Types VECTOR3 = 6

  Sets an MCM_Array or MCM_Dictionary to accept Vector3 value types


enum MCM_Key_Types:

MCM_Key_Types KEY = 0

  A keyboard key

MCM_Key_Types MOUSE = 1

  A mouse button


enum MCM_Modifiers:

MCM_Modifiers ALT = 0

  The alt key

MCM_Modifiers CONTROL = 1

  The control key

MCM_Modifiers META = 2

  The Meta/Windows key

MCM_Modifiers SHIFT = 3

  The shift key

Property Descriptions

String FilePath = "user://MCM//"

 Internal use ONLY do not modify.

 The path to the mods config file folder. This will be updated in the constructor to include the ModID as well.


String ModID = ""

 Internal use ONLY do not modify.

 The mods unique ID. If another mod uses the same ID MCM will not register the mods that load after it.


String FriendlyName = ""

 Internal use ONLY do not modify.

 The name that gets displayed in MCM for users to easily identify.


String Description = ""

 Internal use ONLY do not modify.

 A short description of your mod that gets displayed when hovering over the mods MCM button.


Variant FileOnSaveCallback = null

 Internal use ONLY do not modify.

 The method that gets called when a configuration file is edited and saved within MCM.


Object CallbackObject = null

 Internal use ONLY do not modify.

 The object that holds all of the methods that are passed as the on_value_changed property in values.


Dictionary CreatedValues = {}

 Internal use ONLY do not modify.

 All of the currently created values that will be later saved to the config file.

Constructor Descriptions

MCM_Config MCM_Config(modId: String, modFriendlyName: String, modDescription: String, fileOnSaveCallback: Variant, callbackObject: Object)

Creates the MCM_Config object

Parameter Name Description
modId: String The mods unique ID. Warning: If another mod has this same ID an error will be given and your mod will not be registered
modFriendlyName: String The name that will be displayed within the MCM
modDescription: String A short description of the mod
fileOnSaveCallback: Variant The callback function that will handle value updates for your mod
callbackObject: Object The object to call for individual value on_value_changed callbacks

Method Descriptions

void RegisterMod() const

 Checks to see if the config file has already been created. Creates the file if it hasnt or checks if it has been updated if it was already created. Then registers your mod's config with MCM.


ConfigFile CreateConfigFile() const

 Internal use ONLY. Do not use this method for config file creation. Use RegisterMod instead.

 Generates the config file with all the values that were previously created.


MCM_Category CreateCategoryHeader(id: String, name: String)

 Creates and adds an MCM_Category value to the config file.

Example:
CreateCategoryHeader("Test Category 2", "Test Category 2") \
    .setMenuPos(1)

MCM_String CreateStringValue(id: String, name: String, tooltip: String, default: String)

 Creates and adds an MCM_String value to the config file.

Example:
CreateStringValue("testString", "Test String", "A test string", "Hello World") \
    .setCategory("Test Category 2") \
    .setMenuPos(1)

MCM_Int CreateIntValue(id: String, name: String, tooltip: String, default: int)

 Creates and adds an MCM_Int value to the config file.

Example:
CreateIntValue("testInt", "Test Int", "A test int", 5) \
    .setMinRange(0) \
    .setMaxRange(20) \
    .setOnValueChanged("IntCallback") \
    .setCategory("Test Category 1") \
    .setMenuPos(1)

MCM_Float CreateFloatValue(id: String, name: String, tooltip: String, default: float)

 Creates and adds an MCM_Float value to the config file.

Example:
CreateFloatValue("testFloat", "Test Float", "A test float", 10.3) \
    .setMinRange(0) \
    .setMaxRange(50.5) \
    .setStep(0.01) \
    .setCategory("Test Category 1")

MCM_Bool CreateBoolValue(id: String, name: String, tooltip: String, default: bool)

 Creates and adds an MCM_Bool value to the config file.

Example:
CreateBoolValue("testBool", "Test Bool", "A test bool", false) \
    .setCategory("Test Category 1")

MCM_Keycode CreateKeycodeValue(id: String, name: String, tooltip: String, default: Key, defaultType: MCM_Key_Types)

 Creates and adds an MCM_Keycode value to the config file.

Example:
CreateKeycodeValue(
        "testKeycode",
        "Test Keycode",
        "A test keycode",
        KEY_ALT, 
        MCM_Config.MCM_Key_Types.KEY
    ) \
    .addShiftModifier() \
    .setCategory("Test Category 2")

MCM_Color CreateColorValue(id: String, name: String, tooltip: String, default: Color)

 Creates and adds an MCM_Color value to the config file.

Example:
CreateColorValue("testColor", "Test Color", "A test color", Color.WHITE) \
    .setCategory("Test Category 3")

MCM_Dropdown CreateDropdownValue(id: String, name: String, tooltip: String, default: String, options: Dictionary)

 Creates and adds an MCM_Dropdown value to the config file.

Example:
CreateDropdownValue(
        "testDropdown",
        "Test Dropdown",
        "A test dropdown",
        "opt_1",
        {
            "opt_1": "Option 1",
            "opt_2": "Option 2",
            "opt_3": "Option 3"
        }
    ).setCategory("Test Category 3")

MCM_Vector2 CreateVector2Value(id: String, name: String, tooltip: String, default: Vector2)

 Creates and adds an MCM_Vector2 value to the config file.

Example:
CreateVector2Value("testVector2", "Test Vector2", "A test vector2", Vector2(10, 10)) \
    .setMinRange(Vector2(0, 5)) \
    .setMaxRange(Vector2(50, 40)) \
    .setStep(0.5) \
    .setIsInt(false)

MCM_Vector3 CreateVector3Value(id: String, name: String, tooltip: String, default: Vector3)

 Creates and adds an MCM_Vector3 value to the config file.

Example:
CreateVector3Value("testVector3", "Test Vector3", "a test vector3", Vector3(10, 10, 10)) \
    .setMinRange(Vector3(0, 4, -10)) \
    .setMaxRange(Vector3(50, 40, 20)) \
    .setStep(1) \
    .setIsInt(true) \
    .setCategory("Test Category 4")

MCM_Array CreateArrayValue(id: String, name: String, tooltip: String, default: Array, valueType: MCM_Collection_Types, defaultItemValue: String | int | float | bool | Color | Vector2 | Vector3)

 Creates and adds an MCM_Array value to the config file.

Example:
CreateArrayValue(
        "testVector3Array",
        "Test Array",
        "A test array",
        [],
        MCM_Config.MCM_Collection_Types.VECTOR3,
        Vector3.FORWARD
    ).setExpanded(true) \
    .setMinRange(Vector3.ZERO) \
    .setMaxRange(Vector3(40, 50, 10)) \
    .setMaxItems(5) \
    .setCategory("Test Category 4")

MCM_Dictionary CreateDictionaryValue(id: String, name: String, tooltip: String, default: Dictionary, valueType: MCM_Collection_Types, defaultItemValue: Dictionary)

 Creates and adds an MCM_Dictionary value to the config file.

Example:
CreateDictionaryValue(
        "testStringDictionary",
        "Test Dictionary",
        "A test dictionary",
        { "Test Key": "Test Value" },
        MCM_Config.MCM_Collection_Types.STRING,
        { "Key": "Value" }
    ).setMaxItems(5)

Clone this wiki locally