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

Status
Not open for further replies.
Joined
Jun 30, 2017
Messages
42
Reaction score
35
First Language
spanish
Primarily Uses
RMMV
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 :p

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.
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
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.
 
Joined
Jun 30, 2017
Messages
42
Reaction score
35
First Language
spanish
Primarily Uses
RMMV
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)​
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
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.
 
Joined
Jun 30, 2017
Messages
42
Reaction score
35
First Language
spanish
Primarily Uses
RMMV
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.
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
Glad things are going well; it's good to execute the commands when you want. :p 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.
 

Bricabrac

The Storyteller
Veteran
Joined
May 24, 2016
Messages
113
Reaction score
218
First Language
Italian
Primarily Uses
RMMV
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.
 

NoobCoder

Villager
Member
Joined
Jun 27, 2020
Messages
12
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
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
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ

@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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top