MZ Horizontal Command Help? (SOLVED)

Hello, this plugin from @caethyril and @MechPen is beautiful. How to modify it to be a horizontal menu instead?

Added the following code but don't know how to edit width.
JavaScript:
Window_MenuCommand.prototype.maxCols = function () {
    return 7;
  }

  Window_MenuCommand.prototype.numVisibleRows = function() {
    return 1;
  };

  Window_MenuStatus.prototype.numVisibleRows = function() {
    return 1;
  };

Sorry, found solution immediately after post...
JavaScript:
   (alias => {
        Scene_Menu.prototype.commandWindowRect = function() {
        const rect = alias.apply(this, arguments); // calculate as normal
        rect.width = 900; // Set the width to your desired value
        rect.height = this.calcWindowHeight(1, true); // Adjust the number of commands shown at once if needed
        rect.x = (Graphics.boxWidth - rect.width) / 2; // Center the window horizontally
        rect.y = (Graphics.boxHeight - rect.height) / 2; // Center the window vertically
        return rect;
        };
    })(Scene_Menu.prototype.commandWindowRect);
You'd want to do 3 things:
  • Make Window_MenuCommand inherit from Window_HorzCommand instead of Window_Command.
  • Change the scene's commandWindowRect to suit the new layout.
  • Tell Window_MenuCommand how many columns to show.
Maybe:
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ
 * @plugindesc Simple horizontal-commands pause menu.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/167388/
 * @help Free to use and/or modify for any project, no credit required.
 */

// Patch - hide other windows.
void (alias => {
  Scene_Menu.prototype.create = function() {
    alias.apply(this, arguments);
    for (const c of this._windowLayer.children)
      if (c._isWindow && c !== this._commandWindow)
        c.hide();
  };
})(Scene_Menu.prototype.create);

// Override - new rectangle for horizontal layout.
Scene_Menu.prototype.commandWindowRect = function() {
  const h = this.calcWindowHeight(1, true);
  const w = 500;
  const y = Graphics.boxHeight - h >> 1;
  const x = Graphics.boxWidth - w >> 1;
  return new Rectangle(x, y, w, h);
};

// Override - change menu command window superclass.
Object.setPrototypeOf(Window_MenuCommand, Window_HorzCommand.prototype);

// Override - change columns of menu command window.
Window_MenuCommand.prototype.maxCols = function() {
  return 3;
};

Edit: oh I didn't see the OP's edit. 😅

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.


[Edit 2: added missing .prototype on Window_HorzCommand. 😴]

Original thread: https://forums.rpgmakerweb.com/threads/horizontal-command-help-solved.167388/