Help on scripting conversations, waits after $gameMessage.add()

Hi, I am currently working on a plugin, and i am facing some problems trying to understand how
messages work in the javascript api.

I am not a totally novice on javascript, but new on rpg maker mv 😛

My code is inside a plugin command:
Code:
    $gameMessage.add("Hi1");

How to script a wait for user to close the message window?
Choices have callbacks, but $gameMessage.add() automatically returns (i supose there's a queue of messages) and the rest of my script is executed. Example:

Code:
    // code inside a plugin command

    $gameMessage.newPage();
    $gameMessage.add("Hi1");

    $gameMessage.newPage();
    $gameMessage.add("Hi2");

    console.log("END HERE");  // This is inmediatelly executed before all messages are displayed and closed by the user :(

Some side effects of this:

Code:
    $gameMessage.setFaceImage('testman',0); // Setting face 0
    $gameMessage.newPage();
    $gameMessage.add("Hi1");

    $gameMessage.setFaceImage('testman',2); // Setting face 2 (inmediatelly executed)
    $gameMessage.newPage();
    $gameMessage.add("Hi2");

Because setFaceImage('testman', 2) is inmediatelly executed, what you see in-game is
two messages with the same face ('2' in this case, te last executed one).

How is a wait for messageBox-close scripted?

Any help will be apreciated.
The code you write gets sent to the message box and then when it detects new string information, it starts reading through the string. The reason it's executed so quickly, is because the execution of gameMessage.add is done once text is sent to the messageBox queue.

After that things process like normal.

The close event for the message box simply waits for user input.
The code you write gets sent to the message box and then when it detects new string information, it starts reading through the string. The reason it's executed so quickly, is because the execution of gameMessage.add is done once text is sent to the messageBox queue.

After that things process like normal.

The close event for the message box simply waits for user input.

Thanks for your help Kino 🙂

I understand that, but how can i wait between message.add() calls?

What i'am trying to achieve is:

select face image 1
show text with face 1
select face image 2
show text with face 2
when messagebox is closed, and not before that:
do something else (console log in this example)​
I could provide you with an example, but my response would be really silly.
This thing is handled by Window_Message.

I can't give too many specifics here. If you were to try and put a wait in manually, you'd pause the game.
Here's some code to show you how Game_Interpreter handles when you do showText in game.
http://prntscr.com/fvbzgk

As you can see it does setWaitMode('message')
Near the bottom, which it's waiting on before going to the next showText command with the inputted variables from the game event menu for example.
Thanks for your help Kino.

After looking at GameInterpreter i realized that one cannot simply do gameMessage.add calls, to code a serie of dialogs.
I ended up creating a queue of objects than contains [message+optional_face+optional_choose_options_and_callbacks], and playing with this._index to call the same pluginCommand after each message/options-dialog until there are no messages on the queue.

My plugin purpose is to move conversational logic out of the rpgmaker event editor, to code in javascript specific dialogs for specific
npc-types.

For example: Someone talks about the 'blue dragon', now the topic 'blue dragon' gets activated.
You can talk to any npc on the game about the blue dragon, if one of the npc types is "the blue people"
After ending the blue dragon quest, the topic gets deactivated.

Having a queue of objects seems to work for this purpose of showing gameMessages in a convenient order.

I will publish the plugin when it gets documented and free of known bugs.
Glad things are going well; it's good to execute the commands when you want. 😛 makes life easier though careful. Game_Interpreter can be finicky. Requires a map ID to work at all.

Tell me what your findings are; I have a project involving the game interpreter.
My plugin purpose is to move conversational logic out of the rpgmaker event editor, to code in javascript specific dialogs for specific
npc-types.
Just passing to say that I would love to see your code, even if it's incomplete! I've made a very similar dialogue system through a wonky mix of rpgmaker commands + Javascript bits, and I'm now trying to make it JS-only. We're probably facing the same problems.
Hello, I know lots of time has passed since the first post, but I just went on the same problem and I solved it by creating a simple text (from rpgmmv user interface, not by script) with only \^ as text, between the scripted texts. This \^ is seen by the system as a "skip input" command, but the use of a text command create a break between your scripted text. Screenshot below:
ashahsd.JPG


This is my first forum at all, I'm using RPG maker just as a sort of relaxing hobby (never finished a game) but I love to solve problems without downloading plugins and I made mines that are working with the standard core script (without other people's engines).

Maybe this is not a full script solution, but it works well for my actual purpose and it's easy to use, you can also set the variable for the party actor you want to speak and run the script as common event like below:
ashahsd.JPG

@NoobCoder , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


I've left your post since it could be helpful for people who stumble upon this thread in the future.

I'm closing this thread.

Original thread: https://forums.rpgmakerweb.com/threads/help-on-scripting-conversations-waits-after-gamemessage-add.81236/