Turn switch on after close any kind of window

Status
Not open for further replies.

thalesgal

Veteran
Veteran
Joined
Dec 23, 2016
Messages
195
Reaction score
45
First Language
Portuguese
Primarily Uses
RMMV
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!
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
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 :)
 

thalesgal

Veteran
Veteran
Joined
Dec 23, 2016
Messages
195
Reaction score
45
First Language
Portuguese
Primarily Uses
RMMV
Hello @ShadowDragon thank you so much for answer! :D

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!
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
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 :)
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
Aliasing Window_Base.prototype.close to make it change the switch should do it, I think
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
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:
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
...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
 
Last edited:

thalesgal

Veteran
Veteran
Joined
Dec 23, 2016
Messages
195
Reaction score
45
First Language
Portuguese
Primarily Uses
RMMV
@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

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
@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. :cutesmile::thumbsup-right: 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:

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.
 

thalesgal

Veteran
Veteran
Joined
Dec 23, 2016
Messages
195
Reaction score
45
First Language
Portuguese
Primarily Uses
RMMV
Got it!!
You had already thought of everything haha

Awesome thank you!
 

Touchfuzzy

Rantagonist
Staff member
Lead Eagle
Joined
Feb 28, 2012
Messages
7,295
Reaction score
8,904
First Language
English
Primarily Uses
RMMZ

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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top