[Solved] How to add a new option in the menu?

I want to add a new option to the menu that appears when left clicking on the screen but the lines in the code about it are unreadable because of the lack of spaces, so I’m wondering if there’s a easy way to do this.

You mean an popup when left clicking anywhere like “Develop new game”?
(And move this topic to modding category)

oh right, I forgot about the category, sorry!

and yes, that’s the menu I’m thinking of.

Then, you can do it like this:

    menuItems.push({
    			label: "//Name (eq. Develop new game)",
    			action: function() {
    				Sound.click();
}};

Thats an small example, it would do nothing, only make an sound when clicked.

1 Like

Elaborating on @Haxor’s example:

var oriShowMenu = UI.showContextMenu;
var myShowMenu = function(menuItems, mouseLocation) {
    menuItems.push({
        label: "Label", //menu item text
        action: function() { //this function gets called when you click it
            Sound.click();
            //do something
        }
    });
}
UI.showContextMenu = myShowMenu;

Oh, and you can make the game code readable by pasting it on a beautifier website.

Hope this helps :slight_smile:

2 Likes

thanks for that and the website!