MV [SOLVED] Change rows of Show Choices (or: how to scroll choices)

Hey, there.

I'm looking for a script that let me change the "rows" displayed for choices.
The default settings show 4 choices at a time and let you scroll down if there are more.

I want to show only 1 choice and scroll down for more, but only at specific times.

I already know how to permanently change that in the rpg_windows.js, but I want to have a different row count for different events.

Thanks in advance!
if you know how some javascript, you can copy the piece of code that change
the amount that can be seen, and return that to a scriptcall or plugin command,
so you can do (before choices) choices set 1 or however/whatever name you do.
but there can be other ways I think.
I think this is an interesting choice.
Yeah, the problem is that I really don't know much about Javascript.
And I don't really understood your idea, palatkorn. Sorry...

Here's the line in rpg_windows.js I want to change at will - it's in the Window_ChoiceList segment:
Window_ChoiceList.prototype.numVisibleRows = function() {
var messageY = this._messageWindow.y;
var messageHeight = this._messageWindow.height;
var centerY = Graphics.boxHeight / 2;
var choices = $gameMessage.choices();
var numLines = choices.length;
var maxLines = 8;
if (messageY < centerY && messageY + messageHeight > centerY) {
maxLines = 4;
}
if (numLines > maxLines) {
numLines = maxLines;
}
return numLines;
};

If I change the bold number from 8 to 1, I still can create 4+ choices, but I'll scroll between them, one at a time.
It helps with hiding for me, but I hide the link above. Maybe you didn't go into reading.

if with text, change 4 to 1 as well. but you can rather copy paste it in a new plugin,
maybe alias it.

@palatkorn he want show shoices on 1, than use arrow to scroll through them, now hide.
It's usually better to avoid editing the core scripts directly. What I'd recommend is copying that method into a .js file (Save As > File type: All Files, Filename: pluginName.js) and importing it as a plugin. Definitions of existing methods in plugins replace the original definitions: in that sense a plugin is basically an edit that you can track easily and turn on/off via the Plugin Manager. 😮‍💨

To let you change the value mid-game, you could set it to a game variable value instead:
JavaScript:
var maxLines = $gameVariables.value(1);  // value of game variable #1
Just replace the 1 with whatever ID is convenient for you. 🙂

In case you're interested, here's an example (untested) using a plugin parameter for the variable ID:
Spoiler: Suggested plugin code
JavaScript:
/*:
 * @plugindesc Control the number of choices using a game variable.
 * @param Variable ID
 * @type variable
 * @default 1
 */
(function() {
  // Store plugin parameter value as number in local variable "id"
  var id = parseInt(PluginManager.parameters('pluginName')['Variable ID'], 10);
  // Override existing method
  Window_ChoiceList.prototype.numVisibleRows = function() {
    var messageY = this._messageWindow.y;
    var messageHeight = this._messageWindow.height;
    var centerY = Graphics.boxHeight / 2;
    var choices = $gameMessage.choices();
    var numLines = choices.length;
    var maxLines = $gameVariables.value(id);  // <- edit! Value of game variable #id
    if (messageY < centerY && messageY + messageHeight > centerY) {
      maxLines = 4;
    }
    if (numLines > maxLines) {
      numLines = maxLines;
    }
    return numLines;
  };
})();
Note that PluginManager.parameters fetches the parameters by the file name of the plugin, i.e. if you named it something else then you should edit this example to make it match.
Thank you so much, caethyril!!!

Your plugin worked flawlessly!
And thank you, palatkorn and Shadow Dragon for you time!

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/solved-change-rows-of-show-choices-or-how-to-scroll-choices.125972/