Turn switch on after close any kind of window

Hello guys I need help!

I would like to know if it´s possible to make a plugin that allow to turn a switch ON after close any window, like menu, equipment, item, and etc.

I´m using script calls to open these windows separately so the plugin must recognize the closing of any kind of window.
(The switch will be activated when you return to the game screen. No window open)



This guy made something like that, but this one was just for the equipment window. Maybe this can help:





Thank you very much in advance!
this is a big shot, but you can backup that plugin, than change equip to
Menu, else copy past (make correction)

Scene_Menu
Scene_Skill
Scene_Item
etc etc (check rpg_scene) to get scene list.

than repeat it.
I cant tell if that will work, but it should be similair like the equip.

dont forget to make params.

there might be a way for a global switch, but no idea why you need it though 🙂
Hello @ShadowDragon thank you so much for answer! 😀

I need a global thing because I´m using some plugins to open others window as well.
Like I have the following script call:
Code:
Gamefall.ChronoAddons.additional_skill = 1;
$gamePlayer.commandToolMenuSkill();

I tried do what you said but it didn´t work :/

Or maybe I just did it wrong xD

But I think if the plugin just recognize all the window it would be much better xD at least for me as a layman

cheers!
that's is what I ment with a global switch, there is a way to get all scenes,
and probably better than each seperatly. but you might did something wrong though.

I dont know if it had worked or not. But I hope someone can help you with it 🙂
maybe @YoraeRasante are able to help you out with it, because he did it with the equipment 🙂
Aliasing Window_Base.prototype.close to make it change the switch should do it, I think
allow to turn a switch ON after close any window, like menu, equipment, item, and etc.

Tada! *poof*

Got the core done 😉
You still might need a turn off switch when window is open though.
...but might work already as needed based on the way you use the switch... but not sure?

CT_Bolt's Window Closed Plugin: Click Here to Download
I believe since this overwrites a Window function this should be placed at the top of the plugin list for best results 🙂

Use like:
Spoiler
Setup Parameters:
1585153107887.png


Then in a common event:
1585153135032.png


CT_Bolt's Window Closed Plugin: Click Here to Download

Aliasing Window_Base.prototype.close to make it change the switch should do it, I think
That would have been another route to go too. I did think about doing exactly that. However just in case some dev. later down the line uses "Window" instead of "Window_Base" this will still work for those windows also 🙂

Edit:
v1.10
Spoiler
...added more...
1585157459975.png


Now can do a few more things like custom javascript too 🙂
Example:
Closed Code:
Code:
if (!this.isAlreadyClosed) {console.log('closed:' + $gameVariables.value(1)); this.isAlreadyClosed = true;}
Opened Code:
Code:
console.log('opened: ' + $gameVariables.value(2)); this.isAlreadyClosed = false;
1585156839212.png
@ct_bolt Thank you so much my friend!!! You are the guy!! It worked perfectly for what I wanted to do. Thank you!

Just a little thing I notice:
The switch is activated after text messages too (I don't know if it was in your plans)
But that’s fine to me. The plugin is perfect for me.

Cheers!!
@ct_bolt Thank you so much my friend!!! You are the guy!! It worked perfectly for what I wanted to do. Thank you!
Yay! No prob. ☺️👍 Glad to hear it works as you need.
The switch is activated after text messages too (I don't know if it was in your plans)
Yes indeed any window that closes/opens triggers it including "Window_Message" (aka. text messages).
That is why have also placed a name variable so you can specify any window you'd like with a conditional check) so if you don't want it to stuff to happen every single window you can check if it's the window you want.
Like in the common event:
index.php

How I used $gameVariables.value(1) === 'Window_Message' you could instead use something like
$gameVariables.value(1) !== 'Window_Message' to do stuff when a window is closed unless the window is the Text Window.

Hope that makes sense.
Got it!!
You had already thought of everything haha

Awesome thank you!

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/turn-switch-on-after-close-any-kind-of-window.119417/