Plugin Settings

Declare typed settings and sections that render automatically in the controller UI.

Overview

Settings are declared as member variables on your plugin class. Each setting self-registers with the plugin at construction time — the SDK handles serialization to the controller and routing updates back to the typed member. No manual if/else chains needed.

#include <titan/plugin.h>
#include <titan/setting.h>

class MyPlugin : public titan::Plugin {
    TITAN_PLUGIN("my_plugin", "My Plugin")

    titan::BoolSetting  showOverlay{this, "show_overlay", "Show Overlay", true};
    titan::IntSetting   radius{this, "radius", "Scan Radius", 10, 1, 50};
    titan::ComboSetting mode{this, "mode", "Mode", 0, {{0, "Passive"}, {1, "Active"}, {2, "Aggressive"}}};
    titan::StringSetting filter{this, "filter", "Name Filter", "Chicken"};
};

Setting Types

BoolSetting (Checkbox)

titan::BoolSetting loud{this, "loud", "Verbose Logging", false};

Renders as a checkbox in the controller. Implicitly converts to bool, so you can write if (loud) { ... }.

ParameterTypeDescription
ownerPlugin*Always this
keyconst char*Unique key within the plugin
nameconst char*Display label in the UI
defaultValueboolInitial value
metaSettingMetaOptional: section, position, hidden, tooltip

IntSetting (Slider)

titan::IntSetting radius{this, "radius", "Scan Radius", 10, 1, 50};

Renders as a horizontal slider with min/max bounds. Implicitly converts to int32_t.

ComboSetting (Dropdown)

titan::ComboSetting mode{this, "mode", "Mode", 0, {
    {0, "Off"},
    {1, "Highlight"},
    {2, "Auto-click"}
}};

Renders as a dropdown. The stored value is an int32_t; each ComboChoice maps an integer to a display label. Maximum of 30 options per combo.

StringSetting (Text Input)

titan::StringSetting npcName{this, "npc_name", "NPC Name", "Goblin"};

Renders as a text input field. Implicitly converts to const std::string& and provides c_str().

ProtectedStringSetting (Password)

titan::ProtectedStringSetting pin{this, "pin", "Bank PIN", ""};

Same as StringSetting but the controller renders it as a password field and encrypts the value at rest with DPAPI.

Sections

Sections group related settings under collapsible headers in the UI. Settings without a section render under a synthetic "General" group.

titan::Section combatSection{this, "combat", "Combat"};
titan::Section lootingSection{this, "looting", "Looting", {
    .description = "Ground-item pickup settings",
    .position = 1,
    .closedByDefault = true
}};

// Assign settings to sections via SettingMeta
titan::BoolSetting autoAttack{this, "auto_attack", "Auto Attack", false,
    {.section = &combatSection}};
titan::IntSetting lootRadius{this, "loot_radius", "Loot Radius", 5, 1, 20,
    {.section = &lootingSection}};

SectionOptions

FieldTypeDefaultDescription
descriptionstd::string""Tooltip text on the section header
positionint32_t0Ordering relative to other sections (lower = first)
closedByDefaultboolfalseCollapse the section on first view

SettingMeta

Every setting type accepts an optional SettingMeta as the last constructor parameter:

titan::BoolSetting advanced{this, "advanced", "Advanced Mode", false, {
    .section = &advancedSection,
    .position = 10,
    .hidden = false,
    .tooltip = "Enables advanced features for experienced users."
}};
FieldTypeDefaultDescription
sectionSection*nullptrOwning section. nullptr = "General" group.
positionint32_t0Ordering within the section.
hiddenboolfalseInitially hidden. Can be toggled at runtime via setHidden().
tooltipstd::string""Hover tooltip in the controller UI.

Reacting to Changes

Override onSettingChanged to react when the user modifies a setting in the controller:

void onSettingChanged(const std::string& key) override {
    if (key == "radius") {
        rebuildScanArea();
    }
}

You can also call setting.set(newValue) programmatically — this updates the value and fires onSettingChanged as if the controller had pushed the update.

Runtime Visibility

Settings can be shown or hidden dynamically. Use this to reveal advanced options only when a prerequisite setting is enabled:

void onSettingChanged(const std::string& key) override {
    if (key == "advanced") {
        debugMode.setHidden(!advanced);
    }
}

Limits

LimitValue
Max settings per plugin40
Max sections per plugin16
Max options per combo30
Max string length (setting values)4096 chars
Max setting key length32 chars
Max setting name length64 chars