Weird dialogue plugin behavior

Hey guys and gals!

I just started using this plugin: https://www.patreon.com/posts/release-hms-mode-5218404

and it works really well with near 0 configuration. However, whenever I put the dialogue choices in a loop, I get a:

"TypeError
Cannot read property 'y' of null"

I haven't checked everything everywhere, but the looping definitely breaks it somehow. Any idea how I could attempt to fix it?

I've moved this thread to Plug-In Support. Thank you.

Yup, thanks and sorry for that.
every error report comes with a line number.
you have to provide the line number that throws the error, so that people knows what to read.

"Doctor, I'm in pain! Give me something!"
"Where does it hurt?"
"What do I know! You're the doctor, you figure it out!"
¯\_(ツ)_/¯
Well, call me blind, but...

ohreally-tuneq5BR.1511871930.png

Where's the number you're talking about?
in the console output you get, when you run the game in debug mode, from the editor.
Alright... If I figured out the console correctly, here's what I get:

TypeError: Cannot read property 'y' of null
at Window_ChoiceList.numVisibleRows (HIME_HMSChoiceDisplayMode.js:195)
at Window_ChoiceList.Window_Command.windowHeight (rpg_windows.js:1309)
at Window_ChoiceList.updatePlacement (rpg_windows.js:3847)
at Window_ChoiceList.updatePlacement (YEP_MessageCore.js:908)
at Window_ChoiceList.updatePlacement (HIME_HMSChoiceDisplayMode.js:155)
at Window_ChoiceList.start (rpg_windows.js:3831)
at Window_ChoiceList.start (HIME_HMSChoiceDisplayMode.js:146)
at Window_Message.startInput (rpg_windows.js:4437)
at Window_Message.update (rpg_windows.js:4309)
at rpg_core.js:6523
Code:
var TH_WindowChoiceList_numVisibleRows = Window_ChoiceList.prototype.numVisibleRows;
  Window_ChoiceList.prototype.numVisibleRows = function() {
    // need to calculate how much space is left
    if (this._choiceMode === 1) {
      var textState = this._messageWindow._textState;
      var y = textState.y;      ##<<<<<<< that should be the problem
      var textHeight = textState.height;
      var messageHeight = this._messageWindow.height - this.padding * 2
      if (textState.text !== '') {
        y += textHeight;
      }
      return Math.floor((messageHeight - y) / textHeight);
    }
    else {
      return TH_WindowChoiceList_numVisibleRows.call(this);
    }
  };

I'm eyeballing it because I don't have mv in this computer, but that's what "can't read .y of 'null'" means.
textState is null, which means this._messageWindow._textState is also null.
the only instance where I remembre _textState being null, is when the window is created, and when the text finishes processing.
it is the equivalent of pos[] within the message window in Ace (but it is an internal variable? 0o what is it doing across plugins? )
Code:
at Window_ChoiceList.updatePlacement (YEP_MessageCore.js:908)
at Window_ChoiceList.updatePlacement (HIME_HMSChoiceDisplayMode.js:155)
make sure those two plugins are not conflicting, because it first goes to Hime, and then to Yanfly, so Yanfly might be redefining something that Hime needs.

The fact that you think it can be related to looping a dialogue might be that without the loop the code ends as expected, clearing all it's objects (displays the window, you take your option, and the window closes) and then it resumes the program from the message window point that called the choice window (which will create the choice window again when it needs it)
Looping the code around could cause the dialogue window to not close properly, and not give time to the message window to redefine the choice window, which both Hime and YF are dealing with.

I encountered a similar problem a while ago, while trying to create a new choice window.
I ended up just duplicating the window and working on a copy rather than referencing it as a required object because I couldn't isolate it from other processes.

Original thread: https://forums.rpgmakerweb.com/threads/weird-dialogue-plugin-behavior.87808/