MV Forcing a Message Box to close using a Script Call?

I'm try to event a "Skip Cutscene" Event and I need to know if there is a way to forcibly close a Message Box that is open and running using a Script Call.

I'm using YEP_MessageCore if that helps.
I do have a function in my base and altMessageWindow "walk away"
which you can walk away when the message is open.

once a scene is busy, you can't just call a scriptcall unless bound
to a common event I think and target the message window?

how is the cutscene triggered?
will it turn off the switch... or skip to the end to stop it?

reason for this is if you terminate the message (which is easy to add) won't
skip to the end of the message, which should than be added, only I'm not
sure how to do this part.
I'm try to event a "Skip Cutscene" Event and I need to know if there is a way to forcibly close a Message Box that is open and running using a Script Call.

I'm using YEP_MessageCore if that helps.
Not 100% sure what you are looking to do here, but adding \^ to the end of the message forces it to close. But make sure to add a bunch of \.\.\.\.\.\. to make sure it doesn't close up instantly. You can time the whole thing out and then it will just close on it's own.
Not 100% sure what you are looking to do here, but adding \^ to the end of the message forces it to close. But make sure to add a bunch of \.\.\.\.\.\. to make sure it doesn't close up instantly. You can time the whole thing out and then it will just close on it's own.
\^ just show the text in 1x and not animated.
\. is more silence for some time

what he seek is to terminate the message during cut scene
like a whole
bunch if ....... <press button>

exit message

without showing the rest of the text like skip to end, similar to this plugin [Skip Cutscene].
and probably more simplified than that one.

I don't know if there are more like that though, but if its similar, than a plugin
is required which I think it should anyway for this request.
So, this is the Common Event I have for the Skip Cutscene:

Code:
◆If:Script:Input.isTriggered("escape")
  ◆Fadeout Screen
  ◆Plugin Command:ResetAllEventLocations
  ◆Script:$gameMessage.clear();
  ◆Script:$gameMap.eraseEvent($gameVariables.value(639));
  ◆Erase Picture:#1
  ◆Erase Picture:#2
  ◆Erase Picture:#3
  ◆Transfer Player:Volume Teleport (7,5) (Direction: Down, Fade: None)
  ◆
:End

The Erase Event Call works great - WHEN no dialogue is going. I read somewhere that gameMessage.clear would stop the dialogue box and erase it... That's not the case. But maybe I'm just doing it wrong or something.

I would rather not pay for a plugin if I can help it... I'll see what I can find unless someone can figure out a solution.
What you need is probably something in Window_Message, not Game_Message… which makes things slightly tricky, because there's no simple way to get the Window_Message.

Maybe this will work?

JavaScript:
let win = Scene_Manager._scene._windowLayer.children.find(win => win instanceof Window_Message);
if(win) win.pause = false;

I haven't tested it though. Also, even if it works, you'll probably need additional logic to deal with choice windows, pick item, or input number.
From the MV / MZ Script Call List (click image to view full size):

scl-close-message.png
JavaScript:
SceneManager._scene._messageWindow.terminateMessage();
If you actually want to close the choice/number input/select item window, you should use the script call for the relevant window instead. E.g. for choices:

scl-choice-window-etc.png
From the MV / MZ Script Call List (click image to view full size):

View attachment 358050

JavaScript:
SceneManager._scene._messageWindow.terminateMessage();
If you actually want to close the choice/number input/select item window, you should use the script call for the relevant window instead. E.g. for choices:

View attachment 358049

I didn't see that when I was looking through Script Call List... But it doesn't work - or at least not the way I want. The Message box continues to remain unclosed when i hit the key needed. It even opens the next box after the first one closes and continues the entire conversation before skipping the CS.

This is what I did:
Code:
◆If:Script:Input.isTriggered("escape")
  ◆Fadeout Screen
  ◆Plugin Command:ResetAllEventLocations
  ◆Script:SceneManager._scene._messageWindow.terminateMessage();
  ◆Script:$gameMap.eraseEvent($gameVariables.value(639));
  ◆Erase Picture:#1
  ◆Erase Picture:#2
  ◆Erase Picture:#3
  ◆Transfer Player:Volume Teleport (7,5) (Direction: Down, Fade: None)
  ◆
:End

What you need is probably something in Window_Message, not Game_Message… which makes things slightly tricky, because there's no simple way to get the Window_Message.

Maybe this will work?

JavaScript:
let win = Scene_Manager._scene._windowLayer.children.find(win => win instanceof Window_Message);
if(win) win.pause = false;

I haven't tested it though. Also, even if it works, you'll probably need additional logic to deal with choice windows, pick item, or input number.
Unfortunately, this doesn't work either...

I wonder if it has something to do with YEP_MessageCore. I'm using the Wait(\w[]) and the automatic close escape code for this cutscene and I'm wondering if that might have something to do with it.
Ah, right. That's because closing the message window doesn't end your cutscene event. Try this?
JavaScript:
$gameMap._interpreter.command115();  // Exit Event Processing on main interpreter
SceneManager._scene._messageWindow.terminateMessage();
Note that this will skip any other stuff left in the cutscene: move routes, switch/variable changes, etc.
So, this is the Common Event I have for the Skip Cutscene:

Code:
◆If:Script:Input.isTriggered("escape")
  ◆Fadeout Screen
  ◆Plugin Command:ResetAllEventLocations
  ◆Script:$gameMessage.clear();
  ◆Script:$gameMap.eraseEvent($gameVariables.value(639));
  ◆Erase Picture:#1
  ◆Erase Picture:#2
  ◆Erase Picture:#3
  ◆Transfer Player:Volume Teleport (7,5) (Direction: Down, Fade: None)
  ◆
:End

The Erase Event Call works great - WHEN no dialogue is going. I read somewhere that gameMessage.clear would stop the dialogue box and erase it... That's not the case. But maybe I'm just doing it wrong or something.

I would rather not pay for a plugin if I can help it... I'll see what I can find unless someone can figure out a solution.
What if you made your own dialog box, like mimic 100% the dialog box RPG Maker uses, then then use that as an image only for this that can be removed in this same fashion you have setup already?
That sounds extremely inefficient and I really wouldn't recommend it…
Sorry, Everyone.... nothing is working so far. I've decided to put this on the backburner for now since I've been obsessing about it for a few days and there's progress to be made. If you think of anything else that might work, feel free to place it here and I'll try it out.

I have every intention of figuring this out... but I getting burned out at the moment. Need to step back and do something else for a little while.
maybe try this in scriptcall (I put it from my altMessageWindow
Code:
if ($gameMessage.isBusy()) {
     $gameMessage.clear();
     if (SceneManager._scene._messageWindow) {
          SceneManager._scene._messageWindow.close();
      }

or maybe simplified:

Code:
if ($gameMessage.isBusy()) {
     $gameMessage.clear();
     SceneManager._scene?._messageWindow.close()
but it check if the game message is busy first, than close it when possible.
only my altMessageWindow check if the player is walking as well to close it.
Note: the simplified version only works in MZ. (Unless you manually upgrade your nwjs version on MV.)
maybe try this in scriptcall (I put it from my altMessageWindow
Code:
if ($gameMessage.isBusy()) {
     $gameMessage.clear();
     if (SceneManager._scene._messageWindow) {
          SceneManager._scene._messageWindow.close();
      }

or maybe simplified:

Code:
if ($gameMessage.isBusy()) {
     $gameMessage.clear();
     SceneManager._scene?._messageWindow.close()
but it check if the game message is busy first, than close it when possible.
only my altMessageWindow check if the player is walking as well to close it.
Unfortunately, neither one of those worked for me. Thank you for trying... I might have to just be content with what I have right now.

Note: the simplified version only works in MZ. (Unless you manually upgrade your nwjs version on MV.)
I have updated my NWJS to the most recent stable version for MV, but the shortened version still doesn't work... Maybe it'll only work on MZ.
Note: the simplified version only works in MZ. (Unless you manually upgrade your nwjs version on MV.)
it works for me though, only I use the first version for the plugin.
my other use the short-hands for them, and I got no problem.

the code I gave is from my altMessageWindow where you can simply walk
away if a game message is busy.

Unfortunately, neither one of those worked for me. Thank you for trying... I might have to just be content with what I have right now.
can you try the altMesasgeWindow and see if walk away works?
if that one works, I may be able to make a small plugin for you where it works.

as it may require the map update in order to close it.

if that one works, than I could make a scriptcall with a scriptcall
using "closeMsgWindow()" through the comment event and it should
close.

the rest of the common event could still be used the way you have.
only this bit is running by the map update, unsure if that works, but worth a shot?
it works for me though, only I use the first version for the plugin.
my other use the short-hands for them, and I got no problem.

the code I gave is from my altMessageWindow where you can simply walk
away if a game message is busy.


can you try the altMesasgeWindow and see if walk away works?
if that one works, I may be able to make a small plugin for you where it works.

as it may require the map update in order to close it.

if that one works, than I could make a scriptcall with a scriptcall
using "closeMsgWindow()" through the comment event and it should
close.

the rest of the common event could still be used the way you have.
only this bit is running by the map update, unsure if that works, but worth a shot?
Saga Game

The altMessageWindow plugin didn't work, but I'm wondering if I maybe did it wrong. I also have the issue I had with THIS post.

I included my Game Project Folder.... It's large because I haven't done any optimizing yet, but I thought you might need it to troubleshoot any issues.

To get to what you need:

Resume Game - Most Recent File
Open Menu
Go to Books
Open Volumes
Volume 2 is the fastest one to dialogue
Hit ESC when dialogue starts

The Common Event is at the bottom: 195-202
its downloading, I try to get to fix what you need and see what I can do for you.
as I love challenge and try to solve it ^^

while it works on my end, as I do have some YEP plugins but not all
of them in use, just what I need, so I try to figure out what the issue is,
and let you know.

so I see what I can do for you 🙂

(download is received).
Thanks to ShadowDragon and the others that helped... This is solved.

The Solution, for those that want it, is simple:

  1. You need two events [One of them Common]
  2. You need at least one Variable
The first event has to be on the map [and each map that Cutscene uses] and it has to be Parallel Process by itself [This cannot be included in the event controlling the Cutscene].

It should be set up like this:
◆If:Script:Input.isTriggered("escape")
◆Script:$gameMap._interpreter.clear();
: :$gameMessage.clear();
◆Script:$gameMap.eraseEvent($gameVariables.value(1));
◆Common Event:Cutscene Skip
◆
:End
The Variable should be the first line of the Controlling Event, and it should be set to the EventID [Controlling Event = 1; Variable 1 = 1]. You will have to add this Variable to all the controlling events in the Cutscene on each map. Make sure you set up the variable with the right number.

Now set up a Common Event. This event should have all the Self switches, Variables, and Switches that the Cutscene uses in it. Now I had it setup so that I can repeat the Cutscene over and over again, but if you want to setup for a one-time thing then you need to make sure that everything that happens in the Cutscene is controlled by something that can be flipped [Self Switch, Switch, Variable, Etc.]. The Common Event will be where you flip all these switches and such so that the cutscene thinks it's finished. You will also want to give the player any items or skills or whatever that they might get during the Cutscene as well. You might have to figure out a way to avoid giving the player double the items though if the player closes the cutscene after receiving the item...

I think I've held your hand some... DM me if you have any questions.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/forcing-a-message-box-to-close-using-a-script-call.181972/