How to detect when a screen closes?

Hi,

I'm using Napoleon's Dynamic Windowskin script and Theo's Chest System script, and I'm trying to reskin Theo's chest windows to look like the inside of a wooden chest. I've almost got everything working the way I want, except for one little problem: Theo uses the standard Window_Help window at the top of this scene, which is also used in other places in the game. I can reskin it in the chest event, like so:

@>Script: set_skin('woodskin', 'Window_Help')@>Comment: <item: 1, 1>@>Script: open_chest("My Chest")And it comes up the way I want. But I'm not sure how to put the original window skin back when the chest screen closes. The script call to open_chest() is not a blocking call, so I can't put another set_skin() call after it or it will undo the first set_skin() call.

Is there a way to detect when the chest screen closes, so I can reset the windowskin on Window_Help?

Update: I found a workaround, though I don't know if this is a good idea or not. I moved the open_chest() call into a common event, and I invoke the common event instead of calling open_chest directly. According to the RPG Maker documentation, the common event call won't return until the common event is done (in this case, when the chest closes). So I can add a set_skin() call after calling the common event to reset the Window_Help skin. It's not pretty, but it works.

If there is a better way, let me know. I'm still learning...

Original thread: https://forums.rpgmakerweb.com/threads/how-to-detect-when-a-screen-closes.38578/