Skip to content

Instantly share code, notes, and snippets.

@Heyoxe
Last active May 9, 2021 11:48
Show Gist options
  • Save Heyoxe/8fbf1c769e9e3faf8c283ea0323aab36 to your computer and use it in GitHub Desktop.
Save Heyoxe/8fbf1c769e9e3faf8c283ea0323aab36 to your computer and use it in GitHub Desktop.
class CfgPatches {
class E_TEST_ADDON {
name = "My Test Addon";
units[] = {};
weapons[] = {};
requiredVersion = 2.04;
requiredAddons[] = { "vn_emm_main_menu" };
author = "Heyoxe";
};
};
class vn_RscButtonMainMenu_ButtonListButton_7;
class CustomLinkButton: vn_RscButtonMainMenu_ButtonListButton_7 {
url = "https://example.com";
};
class EMM_mainMenu_CfgMenus {
class VN { // That's the VN main menu config
class Menus {
class CustomMenu {
items[] = { // Defines the order of elements in the main button list
"ARandomButton",
"ARandomLinkButton",
"CommunityGuides",
"Connect",
"Exit" // "Exit" class is always aligned to bottom of button list
};
class ARandomButton {
idc = -1;
text = "Hello World!";
tooltip = "Hello World!";
action = "systemChat str [diag_tickTime, isUIContext, 'Hello World!']";
control = "vn_RscButtonMainMenu_ButtonListButton_7";
};
class ARandomLinkButton: ARandomButton {
text = "My link button";
tooltip = "I link to somewhere";
action = "";
control = "CustomLinkButton";
};
class CommunityGuides: ARandomButton { // Just to show how to show a custom display/dialog on top of the menu
idc = 204;
text = "$STR_A3_RscDisplayMain_ButtonCommunityGuide";
tooltip = "$STR_A3_RscDisplayMain_ButtonCommunityGuide_tooltip";
action = "(ctrlparent (_this select 0)) createDisplay 'RscDisplayCommunityGuide'";
};
class Exit: ARandomButton {
idc = -1;
text = "$STR_VN_EMM_MAIN_MENU_SHARED_BACK";
tooltip = "";
action = "with uiNamespace do {['Extras'] call VN_EMM_mainMenu_fnc_showMenu}"; // Or you can replace 'Extras' by 'MainMenu' if you want to go back all the way
};
};
class Extras {
items[] = {
"Credits",
"Expansions",
"CommunityGuides",
"Sitrep",
"CustomMenuButton",
"Exit"
};
class CustomMenuButton { // You are not required to make another submenu, but I'll make one just to show you how to do it
action = "with uiNamespace do {['CustomMenu'] call VN_EMM_mainMenu_fnc_showMenu}"; // onButtonClick event. If not defined or empty, control will be a label.
// With the current action, this will open a sub-menu called "CustomMenu" (configFile >> "EMM_mainMenu_CfgMenus" >> "VN" >> "Menus" >> "CustomMenu" in our case)
condition = "'SGD' in profileName";// Control is created if condition returns true (not defined/empty string is also considered true)
control = "vn_RscButtonMainMenu_ButtonListButton_7"; // Control class (Default button/label class when not defined)
idc = -1; // Control idc (-1 when not defined)
text = "My custom menu";
tooltip = "My super duper awesome menu"; // Control tooltip (not required)
};
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment