-
Notifications
You must be signed in to change notification settings - Fork 17
Custom Sidebar Buttons
Screenshot: Example
How to add a new button to the sidebar.
First create an ideology in the common/ideologies/ folder (See example_button.txt).
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)
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!
And at last we need to add the button to the sidebar. This is done by adding your ideology as a flag to a list.
To add the buttons for all countries:
add_to_global_variable_list = {
name = custom_button_list_flag
target = flag:gui_sidebar_example_button
}
To add the button for only one country:
add_to_variable_list = {
name = custom_button_list_flag
target = flag:gui_sidebar_example_button
}
This effect can be run wherever you want, like a journal entry or an event.
One possibility is to run it in common/history/global/ (See enable_example_button.txt).