MV Show Windows In Evented Main Menu

Hi there!!
I'm trying to make an animated custom main menu with eventing and I've got it planned pretty much. I'm not using Yanfly's plugin and I'm making it all with pictures, variables and all. So, I have this plugin that creates a playtime window in the basic menu by JGreene. Is there a way to create smth similar to it in event? Or like script calling the window when I run my evented menu? I have used VX Ace most of my life and I'm still new to MV yet and I'm learning while progressing as well.
Thanks in advance!
I think you'd want an edit or add-on to JGreene's plugin (this one?), to allow displaying the playtime window on the map scene as well. Maybe with its visibility tied to a switch or something.

Failing that, assuming I've identified the correct plugin, these might work in Script commands:
JavaScript:
// Show playtime window (create it if necessary).
var sc = SceneManager._scene;
if (!sc._playtimeWindow)
  sc.addWindow(sc._playtimeWindow = new Window_Playtime());
sc._playtimeWindow.width = 240;
sc._playtimeWindow.x = 0;
sc._playtimeWindow.y = Graphics.boxHeight - sc._playtimeWindow.height;
sc._playtimeWindow.show();
JavaScript:
// Hide playtime window
SceneManager._scene._playtimeWindow.hide();
Like this, the playtime window will be lost whenever the scene changes. That includes transferring to another map, entering the pause menu, starting battle, etc. 👋

(Alternatively it is possible, but tedious, to show playtime without scripting. Have pictures of the digits 0~9, and use 1 picture per digit. You can get the playtime in seconds via Control Variables -> Game Data -> Other -> Play Time, then divide through by 10, 60, 600, etc to get each digit. Then update at regular intervals. 😴)
I think you'd want an edit or add-on to JGreene's plugin (this one?), to allow displaying the playtime window on the map scene as well. Maybe with its visibility tied to a switch or something.

Failing that, assuming I've identified the correct plugin, these might work in Script commands:
JavaScript:
// Show playtime window (create it if necessary).
var sc = SceneManager._scene;
if (!sc._playtimeWindow)
  sc.addWindow(sc._playtimeWindow = new Window_Playtime());
sc._playtimeWindow.width = 240;
sc._playtimeWindow.x = 0;
sc._playtimeWindow.y = Graphics.boxHeight - sc._playtimeWindow.height;
sc._playtimeWindow.show();
JavaScript:
// Hide playtime window
SceneManager._scene._playtimeWindow.hide();
Like this, the playtime window will be lost whenever the scene changes. That includes transferring to another map, entering the pause menu, starting battle, etc. 👋

(Alternatively it is possible, but tedious, to show playtime without scripting. Have pictures of the digits 0~9, and use 1 picture per digit. You can get the playtime in seconds via Control Variables -> Game Data -> Other -> Play Time, then divide through by 10, 60, 600, etc to get each digit. Then update at regular intervals. 😴)
Thank you so much for replying! And that's right! I just want it to show when the player enter the pause menu.
I tried the Script command you provided and it gives me an error in Developer Tools under Yanfly Core Engine plugin as:
> Reference error: Window_Playtime is not defined
and again:
> Yanfly.Util.displayError

Here's a screenshot of it:
Spoiler: Image
1693509018311.png

Even when I turn off Yep Core Engine plugin, it still gives me the error: Window_Playtime is not defined.
Ah, I think I see the problem. JGreene's plugin defines Window_Playtime locally on the IIFE. That means it can't be referenced outside of that plugin, hence the error.

It would be possible to edit line 40 so that Window_Playtime is global, e.g.
JavaScript:
    window.Window_Playtime = function() {
In theory (barring any other errors) that'll allow the script call to work.
Ah, I think I see the problem. JGreene's plugin defines Window_Playtime locally on the IIFE. That means it can't be referenced outside of that plugin, hence the error.

It would be possible to edit line 40 so that Window_Playtime is global, e.g.
JavaScript:
    window.Window_Playtime = function() {
In theory (barring any other errors) that'll allow the script call to work.
Thank you tons!!
I tried this and the window actually showed up but the digits don't move at all, it stays 00:00:00 only.
...gah, this kind of thing is a big part of why I write my own plugins. 😴

For some reason the window wasn't coded to refresh itself, so you'll have to do that manually, too. You could add this (followed by an appropriate Wait command) as a Script command in a Parallel event:
JavaScript:
var w = SceneManager._scene._playtimeWindow;
if (w) w.refresh();
Hopefully that makes it work! 😅

I've moved this thread to Plugin Support (from MV Support). Thank you.

...gah, this kind of thing is a big part of why I write my own plugins. 😴

For some reason the window wasn't coded to refresh itself, so you'll have to do that manually, too. You could add this (followed by an appropriate Wait command) as a Script command in a Parallel event:
JavaScript:
var w = SceneManager._scene._playtimeWindow;
if (w) w.refresh();
Hopefully that makes it work! 😅
Moved to: Plugin Support (from MV Support)
It finally worked! Thank you so so much for your help! I truly appreciate it!! 😂
Yay! Happy RPG Making~ 😂

Original thread: https://forums.rpgmakerweb.com/threads/show-windows-in-evented-main-menu.160801/