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) { ... }.
| Parameter | Type | Description |
|---|---|---|
owner | Plugin* | Always this |
key | const char* | Unique key within the plugin |
name | const char* | Display label in the UI |
defaultValue | bool | Initial value |
meta | SettingMeta | Optional: 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
| Field | Type | Default | Description |
|---|---|---|---|
description | std::string | "" | Tooltip text on the section header |
position | int32_t | 0 | Ordering relative to other sections (lower = first) |
closedByDefault | bool | false | Collapse 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."
}};
| Field | Type | Default | Description |
|---|---|---|---|
section | Section* | nullptr | Owning section. nullptr = "General" group. |
position | int32_t | 0 | Ordering within the section. |
hidden | bool | false | Initially hidden. Can be toggled at runtime via setHidden(). |
tooltip | std::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
| Limit | Value |
|---|---|
| Max settings per plugin | 40 |
| Max sections per plugin | 16 |
| Max options per combo | 30 |
| Max string length (setting values) | 4096 chars |
| Max setting key length | 32 chars |
| Max setting name length | 64 chars |