Skip to content

Custom Sidebar Buttons

Alexedishi edited this page Jul 29, 2026 · 4 revisions

Screenshot: example_sidebar_01.png

Setup:

How to add a new button to the sidebar.

First create an ideology in the common/ideologies/ folder. See example_button.txt for reference.

The icon set on the ideology is the icon shown on your button. Important here is that this ideology is never triggered or shown!

Then we need a scripted gui in the common/scripted_guis/ folder corresponding to the button. See example_button_sgui.txt for reference.

We then link those two via the localization of the ideology. Localizations can be found in localization/<language>/. Button ideologies have three localization keys: <ideology>, <ideology>_desc and <ideology>_tooltip

The key <ideology> should contain the name of your scripted_gui. And the key <ideology>_desc contains the name shown when hovering over the button. The <ideology>_tooltip is optional and will be shown as a tooltip if you hover over the button. See com_gui_l_english.yml).

Good practice here is to name the ideology and the scripted gui the same, so even if you do not set the localization key for a language, the correct scripted gui is triggered!

Adding the Button in-game:

Once in-game, the button needs to be activated by adding it's ideology as a flag to a list. This effect can be run wherever you want, like a journal entry or an event.

For example, it can be done via common/history/global/ (See enable_example_button.txt).

Adding your button globally:

To add a button for all countries:

add_to_global_variable_list = {
    name = custom_button_list_flag
    target = flag:gui_sidebar_example_button
}

Adding your button to one country:

To add a button for only one country:

add_to_variable_list = {
    name = custom_button_list_flag
    target = flag:gui_sidebar_example_button
}

Clone this wiki locally