MV How to call a choice and message in Plugin

Hello, I have been trying to create a plugin which will show messages and choices with relativly fixed text in them. The first message and choice works fine, but after the choice no more messages will be displayed even though the code gets run!

Here is the code for the first message and choice which work:
$gameMessage.setBackground(1); $gameMessage.setPositionType(1); $gameMessage.add(actorName + " will learn um and it costs " + cost + " " +$dataItems[crystalId].name); $gameMessage.newPage(); if($gameParty.numItems($dataItems[crystalId])>=cost){ $gameMessage.setChoices(['Yes', 'No'], 0, 1); $gameMessage.setChoiceBackground(1); $gameMessage.setChoicePositionType(1); $gameMessage.setChoiceCallback(n => { $gameTemp.JLordSkillTreeLearnMessage(n, crystalId, actorId, interpreter, eventId, cost, skills); });


And here the function which should be called:

Game_Temp.prototype.JLordSkillTreeLearnMessage = function(choicenr, crystalId, actorId, interpreter, eventId, cost, skills) { console.log(choicenr); $gameMessage.newPage(); var actorName = $gameActors.actor(actorId).name(); $gameMap._interpreter.wait(120); $gameMessage.setBackground(1); $gameMessage.setPositionType(1); $gameMessage.add(actorName + " will learn um and it costs " + cost + " " +$dataItems[crystalId].name); $gameMessage.newPage(); $gameMessage.setBackground(1); $gameMessage.setPositionType(1); $gameMessage.add(actorName + " learned skill"); $gameMessage.newPage(); };


I would greatly appreciate help!
the first code, I prefer working those on command script . Choice and message on command
to execute after choose yes and have the requirement can be use plugins like below..
for this, I suggest you to make your own 'simple' plugins..
But i need to do it inside the plugin because i make a plugin-call with the desired skills to learn, and that would be awfully complicated with command scripts...

So how can i write the code so that I can show the corresponding Message?
you need basic to show / pop up message.. I suggest to use plugins with same function. Better not creating same wheel... or you can 'try' and 'catch' the plugins like Yanfly
* cmiiw
I've added this thread to watched when you made it, because I was actually curious myself as to whether there exists a simple solution to this. But since nobody answered with one until now I guess there might not be. I can't give you a straightforward way to do that either, but I can try to point you in the right direction - assuming you're up for a bit of a programming challenge.

First of all, the reason you can't display multiple messages is because you're adding the next one before the previous one has been closed, so it's ignored. You need to wait until the current message is closed, and only add the next one after that. I see 3 potential ways to do that:

- setInterval checking if the interpreter is still running. Least efficient but probably simplest (maybe?). Once it's no longer running, we can display another message. Just make sure to clear the interval when done.
- Inject some code into Game_Interpreter.prototype.updateWaitMode to notify your plugin whenever a message event ends. Then handle whatever needs to happen next there.
- Dynamically create your own temporary event. Check out the list property of an event - it's basically a list of commands the event includes. You could use setupChild on the active interpreter to create a new sub-event with whatever list you provide it.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-call-a-choice-and-message-in-plugin.154862/