MV Change choice window's width via script call

Here'she code for changing window's heigth:

Code:
Window_Base.prototype.lineHeight = function() {
    if ($gameSwitches.value(19, true)) {
        return 26;
    } else {
        return 36;
    }
};
Seems simple enough, but it doesn't work for the width, so "Window_Base.prototype.lineWidth" won't do anything for me. Any solution?
Looks like you're using MV? The choice window's width is determined by the "widest" choice, bounded by a minimum width (96 in the second function below) and a maximum (Graphics.boxWidth, i.e., the width of the game window). The code can be found in rpg_windows.js (assuming you're not using any plugins that affect the choicelist window):

Code:
Window_ChoiceList.prototype.windowWidth = function() {
    var width = this.maxChoiceWidth() + this.padding * 2;
    return Math.min(width, Graphics.boxWidth);
};

Window_ChoiceList.prototype.maxChoiceWidth = function() {
    var maxWidth = 96;
    var choices = $gameMessage.choices();
    for (var i = 0; i < choices.length; i++) {
        var choiceWidth = this.textWidthEx(choices[i]) + this.textPadding() * 2;
        if (maxWidth < choiceWidth) {
            maxWidth = choiceWidth;
        }
    }
    return maxWidth;
};
It works, thanks 🙂

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.

Original thread: https://forums.rpgmakerweb.com/threads/change-choice-windows-width-via-script-call.137807/