Phileas's Options Manager (MZ options menu customizer)

Plugin name: Phileas's Options Manager

Author: Phileas

Version: 1.5.8 for MZ

Release date:
1.0.0 - 2023.July.23
1.3.5 - 2024.December.09
1.4.0 - 2024.December.30
1.4.1 - 2025.February.23
1.4.2 - 2025.April.06
1.5.0 - 2025.April.12
1.5.1 - 2025.April.21
1.5.3 - 2025.April.23
1.5.4 - 2025.May.09
1.5.5 - 2025.May.13
1.5.6 - 2025.May.14
1.5.8 - 2025.May.15

Plugin description:
The plugin does not provide commands.
The options menu is configured via the plugin parameters.

The plugin allows you to add an unlimited number of user options, add the Fullscreen and Message speed commands, hide standard options and run the game in Fullscreen if this mode was enabled when closing the game!

Custom options are set in the plugin parameters via the structure. Each option adjusts a switch or variable.
If a switch is selected in the option settings, the option will adjust it. Otherwise, you need to select a variable!
When selecting a variable, you can adjust the minimum and maximum values, as well as offset (how much the value of the variable will change in one click).
You can choose whether to place the new option at the beginning, middle or end of the menu.

You can also add the Fullscreen command to the options menu and input any name for it.
If you enable the Remember option in the Fullscreen structure, the plugin will remember the state of the fullscreen (even if the option is hidden from the options menu).
That is, if the fullscreen was turned on, when restarting the game will start in fullscreen!

The Window State option allows you to remember the size and state of the window: normal or maximized!
The Message Speed option allows you to adjust the speed of text display in game messages: from slow to instant.
You choose the scale yourself!

You can hide standard options with a number of options that start with the word Show.
You can also use Volume offset to adjust the step length when changing the volume of music and sounds.

How it looks like:
2023-07-25_00-14-47.png


2023-10-02_03-01-57.png


2023-07-24_04-14-58.png


2023-07-24_04-15-11.png


Code

License

This plugin is released under MIT license.
This means that you can freely use the plugin in non-commercial and commercial games and even edit it.
But be sure to include me in the credits!

Compatibility:
The plugin is probably not compatible with other plugins that change the options menu.
If there are any problems, write to me.
Upgrade to version 1.1.0!
  • Fixed a bug hiding standard options
  • Automatic correction of incorrect variable values. If the value of the variable is less than the minimum that you specified in the option settings, then it is set to the minimum. If it is greater than the maximum, it is set to the maximum.
  • Now you can specify the status text of the variable. This is the text that will be written to the right of the variable value. You can enter an empty string.

See the first thread message.
To make the Phileas_OptionsManager plugin compatible with DKTools_Localization, place DKTools_Localization below Phileas_OptionsManager in the plugins menu.

Then DKTools_Localization will be able to display the language switching option in the options menu.
Plugin name: Phileas_OptionsManager

Author: Phileas

Version: 1.1.0 for MZ

Release date:
1.0.0 - 07.23.2023
1.1.0 - 07.24.2023

Plugin description:
The plugin does not provide commands.
The options menu is configured via the plugin parameters.

The plugin allows you to add an unlimited number of user options, add the Fullscreen command, hide standard options and run the game in Fullscreen if this mode was enabled when closing the game!

Custom options are set in the plugin parameters via the structure. Each option adjusts a switch or variable.
If a switch is selected in the option settings, the option will adjust it. Otherwise, you need to select a variable!
When selecting a variable, you can adjust the minimum and maximum values, as well as offset (how much the value of the variable will change in one click).
You can choose whether to place the new option at the beginning, middle or end of the menu.

You can also add the Fullscreen command to the options menu and input any name for it.
If you enable the Remember option in the Fullscreen structure, the plugin will remember the state of the fullscreen (even if the option is hidden from the options menu).
That is, if the fullscreen was turned on, when restarting the game will start in fullscreen!

You can hide standard options with a number of options that start with the word Show.
You can also use Volume offset to adjust the step length when changing the volume of music and sounds.

How it looks like:
View attachment 270557


View attachment 270467

View attachment 270468

View attachment 270469

Code:
Spoiler: Version 1.1.0
Code:
//=============================================================================
// Phileas_OptionsManager.js
//=============================================================================
// [Update History]
// 2023.July.23 Ver1.0.0 First Release
// 2023.July.24 Ver1.1.0 Fixed a bug hiding standard options
//                       Automatic correction of incorrect variable values.
//                       Now you can specify the status text of the variable.

/*:
 * @target MZ
 * @plugindesc Configures the options menu, adds an unlimited number of custom options.
 * @author Phileas
 *
 * @param Options
 * @type struct<Option>[]
 * @default []
 *
 * @param Fullscreen option
 * @type struct<Fullscreen>
 * @default {"Add 'Fullscreen' option?":"false","Fullscreen option name":"Fullscreen","Position":"Bottom"}
 *
 * @param Show 'Always Dash' option?
 * @type boolean
 * @default true
 *
 * @param Show 'Command Remember' option?
 * @type boolean
 * @default true
 *
 * @param Show 'Touch UI' option?
 * @type boolean
 * @default true
 *
 * @param Show 'BGM Volume' option?
 * @type boolean
 * @default true
 *
 * @param Show 'BGS Volume' option?
 * @type boolean
 * @default true
 *
 * @param Show 'ME Volume' option?
 * @type boolean
 * @default true
 *
 * @param Show 'SE Volume' option?
 * @type boolean
 * @default true
 *
 * @param Volume offset
 * @type number
 * @default 20
 * @desc The value by which the volume changes in one click.
 *
 * @help
 * The plugin does not provide commands.
 * The options menu is configured via the plugin parameters.
 *
 * Custom options are set in the plugin parameters via the structure. Each option adjusts a switch or variable.
 * If a switch is selected in the option settings, the option will adjust it. Otherwise, you need to select a variable!
 * When selecting a variable, you can adjust the minimum and maximum values, as well as offset.
 * You can choose whether to place the new option at the beginning, middle or end of the menu.
 *
 * You can also add the Fullscreen command to the options menu and input any name for it.
 * If you enable the Remember option in the Fullscreen structure, the plugin will remember the state of the fullscreen (even if the option is hidden from the options menu).
 * That is, if the fullscreen was turned on, when restarting the game will start in fullscreen!
 *
 * You can hide standard options with a number of options that start with the word Show.
 * You can also use Volume offset to adjust the step length when changing the volume of music and sounds.
 *
 * You can always write to the author if you need other features or even plugins.
 * Boosty: https://boosty.to/phileas
 * RPG Maker Web: https://forums.rpgmakerweb.com/index.php?members/phileas.176075/
 * RPG Maker Union: https://rpgmakerunion.ru/id/phileas
 * Email: olek.olegovich gmail.com
 * Telegram: olekolegovich
 *
 * [License]
 * This plugin is released under MIT license.
 * http://opensource.org/licenses/mit-license.php
 */
 
/*~struct~Option:
 * @param Option name
 * @type string
 * @default Option
 *
 * @param Option switch
 * @type switch
 * @desc If the option should control the switch, select it here. Otherwise, do not assign a switch to the option in any case.
 *
 * @param Option variable
 * @type variable
 * @desc If the option should control the variable, select it here.
 *
 * @param Variable min value
 * @type number
 * @desc If it is variable option.
 * @default 0
 *
 * @param Variable max value
 * @type number
 * @desc If it is variable option.
 * @default 100
 *
 * @param Variable offset
 * @type number
 * @desc If it is variable option. The value by which the variable changes in one click.
 * @default 20
 *
 * @param Variable status text
 * @desc The text that will be written to the right of the variable value. You can input an empty string.
 * @default %
 *
 * @param Position
 * @desc The position of the option in the options menu.
 * @type combo
 * @option Top
 * @option Middle
 * @option Bottom
 * @default Bottom
 */
 
/*~struct~Fullscreen:
 * @param Add 'Fullscreen' option?
 * @type boolean
 * @default false
 * @desc Adds a fullscreen option to the Options window.
 *
 * @param Fullscreen option name
 * @default Fullscreen
 *
 * @param Position
 * @desc The position of the option in the options menu.
 * @type combo
 * @option Top
 * @option Middle
 * @option Bottom
 * @default Bottom
 *
 * @param Remember
 * @type boolean
 * @default true
 * @desc If the value is true, the option value will be restored when the game is restarted.
 */

(function() {

//--------DATA:
    var parameters = PluginManager.parameters("Phileas_OptionsManager");
    var customOptions = parsePluginParamArray(parameters["Options"]) || [];
    var topCustomOptions = [];
    var middleCustomOptions = [];
    var bottomCustomOptions = [];
    var fullscreenOptions = getFullsreenOptionArray(JSON.parse(parameters["Fullscreen option"]) || {"Add 'Fullscreen' option?":false,"Fullscreen option name":"Fullscreen","Position":"Bottom"});
  
    var showAlwaysDash = parameters["Show 'Always Dash' option?"] == "true";
    var showCommandRemember = parameters["Show 'Command Remember' option?"] == "true";
    var showTouchUI = parameters["Show 'Touch UI' option?"] == "true";
    var showBGMVolume = parameters["Show 'BGM Volume' option?"] == "true";
    var showBGSVolume = parameters["Show 'BGS Volume' option?"] == "true";
    var showMEVolume = parameters["Show 'ME Volume' option?"] == "true";
    var showSEVolume = parameters["Show 'SE Volume' option?"] == "true";
    var volumeOffset = Number(parameters["Volume offset"]) || 20;
  
    setCustomOptionsDictionaries();

//--------MY CODE:
    function getClamp(number, min, max) {
        return Math.min(Math.max(number, min), max);
    }

    function parsePluginParamArray(data) {
        if (data == undefined) {
            return undefined;
        }
      
        let arr = JSON.parse(data);
        for (let i = 0; i < arr.length; ++i) {
            arr[i] = JSON.parse(arr[i]);
        }

        return arr;
    }

    function getFullsreenOptionArray(dict) {
        let pos = dict["Position"];
        switch (pos) {
            case "Top":
                pos = 0;
                break;
            case "Middle":
                pos = 1;
                break;
            default:
                pos = 2;
                break;
        }
      
        return [dict["Add 'Fullscreen' option?"] == "true", dict["Fullscreen option name"], pos, dict["Remember"] == "true"];
    }
  
    function setCustomOptionsDictionaries() {
        let dict = {};
        for (let i in customOptions) {
            let opt = customOptions[i];
            let tag = "phileasCustomOption" + i;
            let isSwitchOption = opt["Option switch"] != "";
            opt["Option switch"] = Number(opt["Option switch"]);
            opt["Option variable"] = Number(opt["Option variable"]);
            opt["Variable min value"] = Number(opt["Variable min value"]);
            opt["Variable max value"] = Number(opt["Variable max value"]);
            opt["Variable offset"] = Number(opt["Variable offset"]);
            if (isSwitchOption) {
                tag += "Switch";
                dict[tag] = [true, opt["Option switch"]];
            }
            else {
                tag += "Volume";
                dict[tag] = [false, opt["Option variable"], opt["Variable min value"], opt["Variable max value"], opt["Variable offset"], opt["Variable status text"]];
            }

            switch (opt["Position"]) {
                case "Top":
                    topCustomOptions.push([tag, opt["Option name"], isSwitchOption]);
                    break;
                case "Middle":
                    middleCustomOptions.push([tag, opt["Option name"], isSwitchOption]);
                    break;
                default:
                    bottomCustomOptions.push([tag, opt["Option name"], isSwitchOption]);
                    break;
            }
        }
      
        customOptions = dict;
    }

    Window_Options.prototype.addFullscreenOption = function(pos) {
        if (fullscreenOptions[0] === true && fullscreenOptions[2] == pos) {
            this.addCommand(fullscreenOptions[1], "fullscreen");
        }
    }
  
    Window_Options.prototype.addCustomOptions = function(pos) {
        let arr = undefined;
        switch (pos) {
            case 0:
                arr = topCustomOptions;
                break;
            case 1:
                arr = middleCustomOptions;
                break;
            default:
                arr = bottomCustomOptions;
                break;
        }
      
        for (let i in arr) {
            this.addCommand(arr[i][1], arr[i][0]);
            let co = customOptions[arr[i][0]];
            let n = co[1];
            let value = this.getConfigValue(arr[i][0]);
            if (value == undefined) {
                if (arr[i][2] === true) {
                    value = $gameSwitches.value(n);
                }
                else {
                    const varValue = $gameVariables.value(n);
                    if (varValue < co[2]) {
                        $gameVariables.setValue(n, co[2]);
                    }
                    else if (varValue > co[3]) {
                        $gameVariables.setValue(n, co[3]);
                    }
                  
                    value = $gameVariables.value(n);
                }
              
                this.changeValue(arr[i][0], value);
            }
        }
    }

//--------CHANGED CORE:

    Window_Options.prototype.makeCommandList = function() {
        this.addFullscreenOption(0);
        this.addCustomOptions(0);
        this.addGeneralOptions();
        this.addFullscreenOption(1);
        this.addCustomOptions(1);
        this.addVolumeOptions();
        this.addFullscreenOption(2);
        this.addCustomOptions(2);
    };

    Window_Options.prototype.addGeneralOptions = function() {
        if (showAlwaysDash) {
            this.addCommand(TextManager.alwaysDash, "alwaysDash");
        }
      
        if (showCommandRemember) {
            this.addCommand(TextManager.commandRemember, "commandRemember");
        }
      
        if (showTouchUI) {
            this.addCommand(TextManager.touchUI, "touchUI");
        }
    };

    Window_Options.prototype.addVolumeOptions = function() {
        if (showBGMVolume) {
            this.addCommand(TextManager.bgmVolume, "bgmVolume");
        }
      
        if (showBGSVolume) {
            this.addCommand(TextManager.bgsVolume, "bgsVolume");
        }
      
        if (showMEVolume) {
            this.addCommand(TextManager.meVolume, "meVolume");
        }
      
        if (showSEVolume) {
            this.addCommand(TextManager.seVolume, "seVolume");
        }
    };
  
    const Origin_changeVolume = Window_Options.prototype.changeVolume;
    Window_Options.prototype.changeVolume = function(symbol, forward, wrap) {
        let opt = customOptions[symbol];
        if (opt == undefined || opt[0] == true) {
            Origin_changeVolume.call(this, symbol, forward, wrap);
            return;
        }
      
        const lastValue = this.getConfigValue(symbol);
        const offset = opt[4];
        let value = lastValue + (forward ? offset : -offset);
        if (value > opt[3] && wrap) {
            value = opt[2];
        } else {
            value = getClamp(value, opt[2], opt[3]);
        }
      
        this.changeValue(symbol, value);
        $gameVariables.setValue(opt[1], value);
    };
  
    Window_Options.prototype.volumeOffset = function() {
        return volumeOffset;
    };
  
    const Origin_processOk = Window_Options.prototype.processOk;
    Window_Options.prototype.processOk = function() {
        const index = this.index();
        const symbol = this.commandSymbol(index);
        if (symbol == "fullscreen") {
            Graphics._switchFullScreen();
        }
        else {
            let opt = customOptions[symbol];
            if (opt != undefined && opt[0] == true) {
                $gameSwitches.setValue(opt[1], !$gameSwitches.value(opt[1]));
            }
          
            Origin_processOk.call(this);
        }
    };
  
    Window_Options.prototype.statusText = function(index) {
        const symbol = this.commandSymbol(index);
        const value = this.getConfigValue(symbol);
        if (this.isVolumeSymbol(symbol)) {
            let opt = customOptions[symbol];
            return opt != undefined ? value + opt[5] : this.volumeStatusText(value);
        }
      
        return this.booleanStatusText(value);
    };
  
    Origin_switchFullscreen = Graphics._switchFullScreen;
    Graphics._switchFullScreen = function() {
        if (SceneManager._scene instanceof Scene_Options) {
            for (var i = 0; i < SceneManager._scene._windowLayer.children.length; ++i) {
                if (SceneManager._scene._windowLayer.children[i] instanceof Window_Options) {
                    SceneManager._scene._windowLayer.children[i].changeValue("fullscreen", !ConfigManager["fullscreen"]);
                    break;
                }
            }
        }
        else {
            ConfigManager["fullscreen"] = !ConfigManager["fullscreen"];
        }

        ConfigManager.save();
        Origin_switchFullscreen.call(this);
    };
  
    Origin_makeData = ConfigManager.makeData;
    ConfigManager.makeData = function() {
        const config = Origin_makeData.call(this);
        config.fullscreen = fullscreenOptions[3] === true ? ConfigManager["fullscreen"] : undefined;

        for (tag in customOptions) {
            let opt = customOptions[tag];
            customOptions[tag].push(opt[0] ? $gameSwitches.value(opt[1]) : $gameVariables.value(opt[1]));
        }
      
        config.phileasCustomOption = customOptions;
        return config;
    };
  
    Origin_applyData = ConfigManager.applyData;
    ConfigManager.applyData = function(config) {
        if (config.fullscreen != undefined) {
            ConfigManager["fullscreen"] = config.fullscreen;
        }
      
        if (config.phileasCustomOption != undefined) {
            for (tag in config.phileasCustomOption) {
                let opt = config.phileasCustomOption[tag];
                ConfigManager[tag] = opt[opt.length - 1];
            }
        }
      
        Origin_applyData.call(this, config);
    };
  
    const Origin_SceneBoot_start = Scene_Boot.prototype.start;
    Scene_Boot.prototype.start = function () {
        Origin_SceneBoot_start.call(this);
        if (ConfigManager["fullscreen"] === true) {
            Graphics._requestFullScreen();
        }
    };
  
    const Origin_createGameObjects = DataManager.createGameObjects;
    DataManager.createGameObjects = function() {
        Origin_createGameObjects.call(this);
        for (tag in customOptions) {
            let opt = customOptions[tag];
            if (opt[0] === true) {
                $gameSwitches.setValue(opt[1], ConfigManager[tag]);
            }
            else {
                $gameVariables.setValue(opt[1], ConfigManager[tag]);
            }
        }
    }
}());
Or you can download the file here.

License
MIT, all responsibility is on the user.

Compatibility:
The plugin is probably not compatible with other plugins that change the options menu.
If there are any problems, write to me.
download URL is gamehotkey.js
download URL is gamehotkey.js
Thank you! Fixed it.
Upgrade to version 1.2.0!

Added an option for the speed of the message (text).
Fantastic, very useful. Thank you.
Upgrade to version 1.3.0!

Added window state option.

In MV, the size and state of the window do not change when the game is restarted. My plugin not only restores this behavior in MZ, but also restores the state of the window after the game is completely finished and started again.
Upgrade to version 1.3.1!
  • The arrow keys now work correctly with the switches.
  • Also, the displayed values are updated when the options window loads. For example, if you changed the switch of some option outside of this window.

Thanks to Maniaxskell for detecting the bug!
Upgrade to version 1.3.2!
Fixed compatibility with PKD_ExtendedLoot.
Please note that PKD_ExtendedLoot must be placed below my plugin in the plugins menu.
1.3.3

Now you can set custom labels for the switch option.

1.3.4
Added parameters "Options window`s width", "Option value width (status)" and "Max number of visible options".
Phileas,

I love your plugin, but when I use the left and right arrow key to change a Switch option, it changes the value but not the switch on/off. Version 1.3.0 said it fixed the arrow keys, but not for me. Any ideas?
1.3.5
The arrow keys now work correctly with the switches.
It seems to have fixed it already in 1.3.1, but something went wrong.

Zer0Morph, thanks for discovering the bug!
You are very welcome. 😉 I ended up disabling the left and right arrows which turned out to be an effective work around, but since you fixed it, I suppose I can put it back, haha!


Code:
Window_Options.prototype.cursorRight = function() {
    const index = this.index();
    const symbol = this.commandSymbol(index);
    if (this.isVolumeSymbol(symbol)) {
        this.changeVolume(symbol, true, false);
    } else {
        //this.changeValue(symbol, true);
    }
};

Window_Options.prototype.cursorLeft = function() {
    const index = this.index();
    const symbol = this.commandSymbol(index);
    if (this.isVolumeSymbol(symbol)) {
        this.changeVolume(symbol, false, false);
    } else {
        //this.changeValue(symbol, false);
    }
};
I apologize for double posting, but I have to tell you that this plugin is amazing and I greatly appreciate you letting me use it for my project... for FREE no less.

I will absolutely be putting your name in the credits. God bless!
Zer0Morph, for the sake of such feedback, I publish plugins)
Good luck with your project, I will wait for its release!
You have officially joined the other 50+ contributors to 'Age of Tribulation'... and yes, these credits scroll baby! lol :popcorn:

(Is that a clickable link to your Github page?) 😉

Phileas.png
1.4.0

Now you can configure the status texts of the "Always Dash" option.

2024-12-31_01-19-20.png


2024-12-31_01-19-28.png
1.4.1
Added the ability to set the "Fullscreen" option to the default value.
This value applies even if the option is not displayed in the settings menu.

Original thread: https://forums.rpgmakerweb.com/threads/phileass-options-manager-mz-options-menu-customizer.159642/