HimeWorks Large Choices row/column option?

Hello, everyone! I'm currently using Large Choices by HimeWorks/@Tsukihime in an attempt to create a version of the poem writing mini-game from Doki Doki Literature Club, which you can see an example of here:

Spoiler: DDLC Poem Mini-Game


By altering rpg_windows.js and adding the following code:

Spoiler
Window_ChoiceList.prototype.maxCols = function() {

return 2;

};

As well as altering the numVisibleRows, windowWidth, and maxChoiceWidth functions accordingly, I was able to get this result:

Spoiler
fERxB8H.jpg

However, this means that any time I use the "Show Choice" command, there will be two columns. I only want the two column format to be available during this mini-game.

How would I achieve this? I know that SumRndmDde has a Window Upgrade plugin available that can create a choice window with rows and columns, but his plugin command does not allow variables to be passed in (which I need since the word list is stored in an array that is shuffled). If you know how to make variables work with his plugin, then I can use it instead of Hime's Large Choices, but Large Choices is the only one I can use until someone can help me.

Thank you in advance!
How about:

Code:
Window_ChoiceList.prototype.maxCols = function() {

return $gameVariables.value(X);
// X is the variable ID# of a Game Variable
};

Then you can use an Event Command to change the value of Variable #X to 2 before the mini-game, then change it back to normal after the mini-game.
Thank you for the reply, Aloe Guvner!

After trying your suggestion, I'm now running into a weird error where the words themselves aren't being displayed, though the amount of columns is correct and the choice selection is functioning normally (choice selection tested by using "Show Text" to print the chosen word; choice columns tested by listening for audio cues):

Spoiler
e7T1WhQ.jpg

Reverting the maxCols function back to a hard-coded value instead of a game variable makes it function normally. What do you think I should try next?
It works fine for me on a blank project with only that little code snippet installed as a plugin. The screenshots below are using Game Variable #1 as the value for the amount of columns.

Spoiler
Variable1.png


OneColumn.png


Variable2.png


TwoColumns.png


Variable3.png


ThreeColumns.png
It works fine for me on a blank project with only that little code snippet installed as a plugin. The screenshots below are using Game Variable #1 as the value for the amount of columns.


That's really strange... I tried it out on a new project as well - both with and without the use of Hime's Large Choices, but the same thing happened where the choices themselves worked but none of the words were being displayed. Is there a specific line where I need to define the maxCols function? If you were to send me your rpg_windows.js file, would that (in theory) work?

Spoiler: EDITS
EDIT1: I was playing around with the new project just now and somehow got it to work! I did two things, so I'm gonna try to figure out which one actually worked and edit this again!

EDIT2: After further testing, it turns out that my fix didn't actually work. I tried moving the function definition for maxCols earlier, but it ended up being ignored entirely - which is why the words started to display again. I got a little too excited and didn't notice that even though the words were being displayed, the column size was fixed to 1.

EDIT3: After creating yet another new project to test it, this time not even adding Hime's Large Choices js file into the plugins folder, the behavior is still the exact same. I guess my earlier question regarding function placement still stands, and to add to it: will using the regular Notepad editor cause problems?

EDIT4: Another interesting thing. I tried manually defining $gameVariables.setvalue(1, x) inside maxCols (where I change x inside the js file, NOT in RPG Maker) and then returning $gameVariables.value(1), and the words display properly with the correct amount of columns. This means that the error only occurs when I try to define the variable within RPG Maker itself.

EDIT5: Sorry for all the edits, but I noticed just now that you are actually using the code you sent as a plugin - instead of what I'm doing, which is manually editing rpg_windows.js. Would you be able to send me that plugin?
Yeah, by plugin I mean that I just opened a text editor (like Notepad++), typed in the following code, and saved it as 'Something.js'
Then, in the editor, went to the Plugin Manager and installed 'Something.js'

Code:
Window_ChoiceList.prototype.maxCols = function() {
    return $gameVariables.value(1);
};

I don't directly edit the core files (rpg_windows, rpg_scenes, etc.) for 2 reasons:
  1. Edits are lost when you upgrade your project to a new version of RPG MV
  2. Can often forget what edits were made
When I install the HIME_LargeChoices plugin as well, I see the same behavior as you only if the value of the variable is zero. Make sure that you've set the variable to have a value of at least 1 before you open the choices. You can press F9 during a playtest for an easy screen to set the variable.
IT WORKS!!! Because of the way I set up the event, the error was occurring long before the common event for the poem minigame was ever called (I had other "Show Choice" options before it that were never called because of the way I set up the event, but the fact that they were there seemed to have caused the problem since initializing the column variable before then fixed it).

Thank you so much! Hopefully everything discussed here will help someone who wants to do something similar in the future.

This topic can now be closed!
Glad to hear it works!
If you want the thread to be closed, press 'report' on the first post and mention that the issue is solved, a moderator will come around and take care of it.
Alrighty, will do.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/himeworks-large-choices-row-column-option.91425/