MV Help Parsing Message Text

So I have a few lines of dialogue that I want to account for player choice, so I'm using JS to iterate until I find an actor who's in the party, then address them.

Spoiler: Script for reference
Code:
for (var i=10; i<19; i++) {
  if ($gameParty.battleMembers().contains($gameActors.actor(i))) {
    $gameMessage.add("I never thought I'd see you again, " + $gameActors.actor(i).name() + ".");
    break; } }

The issue I'm having is that calling $gameMessage.add() multiple times doesn't display them as individual messages, they get combined into one message window for the scope of this script.

Also, it seems that it's too low level a function and happens after the parsing of command characters, which means I'd need to add my face and name boxes separately.

But then, when I'm trying to look up higher level functions, it's getting into creating a Window_Base variable and filling that out just to show a few lines of text.

So can anyone suggest a higher-level function I can call where I would enter my text exactly as I would in the Show Text event button and it will display as a complete message? Or does Show Text go through everything I described above, with creating and defining a window every time?
Not sure why you're using a script for this when it'd be ten times easier to use a series of conditional branches, and an in game variable set to the actors name.

If all it's doing is finding the first actor in the party with id 10-19, you can easily set a variable to the actorId of party member 0, then check it against a list of valid Ids, set another variable to his name if it finds ones, and then check the other actors in the party if the first actor doesn't match. Then use the built in event commands to display your text above.

I don't have a lot of experience with the actual message window, but working with it seemed pretty clunky to me when I was using it. It seems that using the eventing system to interact with it is the path of least resistance.
Not sure why you're using a script for this when it'd be ten times easier to use a series of conditional branches, and an in game variable set to the actors name.
Because it really isn't...when I have, like, 10 actors available, 2 of whom may be in the player's party, making sure I say two things to two different people who are in the party is a three-line for loop or a huge abomination of, like, 20 nested conditional branches 😛
If all it's doing is finding the first actor in the party with id 10-19, you can easily set a variable to the actorId of party member 0, then check it against a list of valid Ids, set another variable to his name if it finds ones, and then check the other actors in the party if the first actor doesn't match. Then use the built in event commands to display your text above.
Something like this occurred to me, but I wanted to ask this question first, as it's more efficient to do it all in one little script box instead of going back and forth between script and event commands...if it actually works efficiently.
I don't have a lot of experience with the actual message window, but working with it seemed pretty clunky to me when I was using it. It seems that using the eventing system to interact with it is the path of least resistance.
That's what I was afraid of. Thanks for the advice.
wild guess, should the break behind the 1st closing } and than };
to closee all?

here is something on [HM moves] that parses a parameter, but maybe
something you can get out on parsing the gameMessage?

(I cant tell if it helps or not, maybe not, maybe a little)
No, my code works correctly, that was not my question.
Try restarting the message configuration, I have no way to test it now:
Code:
$gameMessage.setBackground(0);
$gameMessage.setPositionType(2);
$gameMessage.add("I never thought I'd see you again, " + $gameActors.actor(i).name() + ".");
Try restarting the message configuration
Thank you for the suggestion. This might make each call show up in its own window; however, ultimately, you're using the same function I already was, so it wouldn't change anything about the fact that text codes don't get parsed in there.
I have a plugin that you're welcome to try and mess around with to see if it does what you need. It does support text codes, but the messages are pulled from an external text file.

https://forums.rpgmakerweb.com/index.php?threads/batch-text-sequenced-dialogue.99093/
That won't quite serve my purposes for including variables that are being calculated dynamically during play, but it's good to know about!

Original thread: https://forums.rpgmakerweb.com/threads/help-parsing-message-text.135833/