MV [SOLVED] Adding an option to the options menu that runs a script

Hey everyone, I'm looking for the ability to add two options to the options menu that will run scripts when selected. I had previously asked about this in Javascript questions that don't need their own thread but unfortunately the solution that Robro gave didn't work. Thus, I am following his advice and making a new thread!

I am using SRD Options Upgrade but I don't think that part matters too much since it mostly just offers a way to organize your options. I just need a way to tie a script to an option and would need the symbol to input into the plugin setup so it would appear in the options menu where I dictate.

Thanks in advance! Let me know if any more information is needed.
I am using SRD Options Upgrade but I don't think that part matters too much since it mostly just offers a way to organize your options
What part didnt work? it showing up, or the functionality?
not ruling out user error on my part cause i quickly set it up, but I coulndnt get the new option to show up with just the plugin (neither did the default fullscreen option provided by the plugin, but its not my problem 🤣). setting up the parameters as if it worked, taking what i gave you yesterday, and placing the option manually seemed fine, but i dont know if that was an issue you had

1768088579147.png


1768088176162.png

1768088048002.png


Spoiler
Code:
(() => {
    var aliasOk  = Window_Options.prototype.processOk;
    Window_Options.prototype.processOk = function() {
        var index = this.index();
        var symbol = this.commandSymbol(index);
        var value = this.getConfigValue(symbol);
        if (symbol.contains('Script')) {
            console.log("click")
        } else {
        aliasOk.call(this);
    }
    };
    var aliasStat  = Window_Options.prototype.statusText;
    Window_Options.prototype.statusText = function(index) {
        var symbol = this.commandSymbol(index);
        if (symbol.contains('Script')) {
            return "";
        } else {
            return aliasStat.call(this, index);
        }
    };
    var aliasGen  = Window_Options.prototype.addGeneralOptions;
    Window_Options.prototype.addGeneralOptions = function() {
        aliasGen.call(this);
        this.addCommand("Script", 'customScript');
    };
})();
Ah, yep, the original one you sent didn't actually add the command so that would make a lot of sense why it didn't work haha. Thank you! I was able to add a second one in this pretty easily too so it's working perfectly now!

Original thread: https://forums.rpgmakerweb.com/threads/solved-adding-an-option-to-the-options-menu-that-runs-a-script.181885/