Restoring previous window color? Assigning window color to a variable?

Status
Not open for further replies.

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
[RMMV]
I have a specific battle in my game in which I want to change the window color, but after the battle, I want to change it back to what the player was using before (the player can control the window color in the menu). Is there a script for assigning the current window color to a variable, then changing it back to that variable after in the battle event or somewhere else?
Is there a script that can be used for that?
 
Last edited:

LMPGames

Veteran
Veteran
Joined
Nov 15, 2017
Messages
57
Reaction score
23
First Language
English
Primarily Uses
RMMV
$gameSystem._windowTone might be what you are looking for. This is the variable that the change window color event uses to change the window color. You could setup a game variable and use the script box to set it using that.
 

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
Well, I can certainly assing $gameSystem._windowTone to a variable, but how do I change the window color back to what is assigned to this variable?
I mean, I only need this because I'm using YEP's plugin that allows the player to customize their window color, so changing it back to the game's default would be kinda rude and would require the player to set up their color again (if they remember the specific RGB combination they had set.
If $gameSystem._windowTone is the current window tone, I just need to know to apply this back. Could you possibly help me with this too?
 

LMPGames

Veteran
Veteran
Joined
Nov 15, 2017
Messages
57
Reaction score
23
First Language
English
Primarily Uses
RMMV
I assume that you are using YEP Options Core?

If so, here is something I just put together. If not let me know which Yanfly plugin you are using.

Ok, first replace your YEP_OptionsCore code with this code:
I have added a game interpreter alias so that you can call the plugin command to return the window color to what it was. To do this first you need to pick a variable to store the windowTone into and in an event somewhere where you are changing the window color set that variable using the script option and tpye $gameSystem._windowTone into the box.

This will store the windowTone in that game variable. Take note of the variable number, you will need that for the plugin command.

Now, when you want to return the window to the previous windowTone use this plugin command:

YEPOpCore SetWindowColor <VariableId>

where <VariableId> is the variable number that you chose to store the window tone in. That's it. Let me know if you need a project example, I can whip one up for you.
 

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
Hey, I'm almost sure your plugin command worked and that I did it right, but...
Yes, I am using the Options Core, and I've changed it to your code.
I know this should have been expected, all my options configs were overwritten, and that wouldn't be a big problem, but in addition of that, the yep options don't seem to exist at all now. The current options menu looks like the RMMV's default one. I made a backup of the options core plugin before changing the code and I can easily restore it, but then the interpreter you've added won't be there.
Maaaaaybe it's my plugin list's order, or it's just something inside the yep options core that needs to be set (and which I probably won't remember since it's been an eternity since I set this one.
Can you guess what is happening? If you need further details, I can provide you, prefereably by private message or something like that.
I can't be sure I managed to do it well because the current options menu doesn't give me the option to personalize the window color, so I tested it with the default one (which could be for some reason the one this plugin commands always set the window color to, or, well, you know, it's good to check)
And thank you very much in advance, this is very useful and you seem to be such a nice person.
Remember to send me your link or nickname so I put your name in my project's credit page.
Again, thank you. :)
upload_2018-7-11_12-41-46.png
 
Last edited:

LMPGames

Veteran
Veteran
Joined
Nov 15, 2017
Messages
57
Reaction score
23
First Language
English
Primarily Uses
RMMV
Ok, try just adding the Game_Interpreter code to the bottom of your existing file and see if the same thing happens. If it does, can you pm me a link or something so i can see your YEP_OptionsCore plugin code or maybe a list of all of the plugins you are using and their versions so I can set up a similar environment to test my changes to OptionsCore and see where any conflicts might be?

Thanks.
 

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
I've sent you my plugin list as well as my previous options core (and also the one I put the interpreter into).

What is happening:

- When I tried to run the options core code you sent me, my previous menu configs were gone and the default rmmv menu overwrote the yanfly's one. BUT now, for some reason I don't understand, my configs are there (in the plugin's config), but the custom menu still doesn't show up.

- When I tried to run the options core in which I added your code in the end, the same happens, but some options simply disappear, for reasons my intellect doesn't process.

- And finally, whenever I try to recover my backup file, my previous configs are gone AND the default menu is still there AND it has only the default options (other plugins' options don't appear).

This is all strange to me, and I don't think it's your fault, since I use a bunch of plugins and there are probably compatibility problems related to my plugin list order.

But, anyway, I'd still appreciate some help to fix this.
 

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
Update 1: I found this (playtesting, with the options menu open)
(still the default menu, still didn't find a solution)
upload_2018-7-11_17-15-48.png
 

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
Update 2:
I THINK I DID IT!

(I'm new to programming, so I'll be using simple terms)
"SyntaxError: Unexpected token )=" was an error on line 960 of YEP's OptionsCore plugin:
upload_2018-7-11_19-31-16.png
this was placed under the interpreter. I placed it on top of it, got the same error on the line it was, then I placed it besides that line (which really makes more sense), and then this error was gone.
Theeen some other plugins (that I had changed and moved around, trying to fix this problem), crashed the game, but I think I finally managed to fix everything. Now I'm going to translate and set the menu again (since my menu profile has been lost during my tries to fix the plugin), and so I'm going to finally test your code again.
Whether it works or not, I'll post here ASAP.
Still testing...
 

FeliPereira97

Veteran
Veteran
Joined
Jun 27, 2018
Messages
33
Reaction score
2
First Language
Portuguese
Primarily Uses
RMMV
Update 4:
IT WORKED!

I needed to retry a bit because I put the variableId inside <> and it shouldn't be this way.
But now it's working very well, I have no more crashes and yep's menu is back.

Thank you very much for your help, Geowil! It may have been a small thing, but it helped me a lot.

Here's what I did:

This is the beginning of the troop event:
upload_2018-7-11_19-51-22.png
(assigned the current window tone to a variable before changing it for the battle)

(it should be defined like this)
upload_2018-7-11_19-52-47.png

And this is the end of the troop event:
upload_2018-7-11_19-52-24.png
(set the window color back to what was assigned to that variable in the beginning of the troop event, after the battle is over)

Again, thanks, this is very useful.

After Geowil replies with their considerations, I think an admin can close this thread (please, wait for their reply).
 

Attachments

  • upload_2018-7-11_19-44-7.png
    upload_2018-7-11_19-44-7.png
    13.9 KB · Views: 3
  • upload_2018-7-11_19-44-33.png
    upload_2018-7-11_19-44-33.png
    43.5 KB · Views: 3
  • upload_2018-7-11_19-45-6.png
    upload_2018-7-11_19-45-6.png
    10.9 KB · Views: 4
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

To be released 2021/10/21
Now that I made this "What the MZ RTP is missing" spreadsheet it's itching me to fill some the gaps D:
Aaaaand I completely forgot about the RMMV Chicken Rave my brother decided to implement in a parody of my VERY FIRST UNFINISHED project. We could not escape the chicken rave... The chickens would block the ladder...
I love how I can look up a problem I'm having with my game, find a post from like six years ago that addresses the issue, and the solution provided still works in RPG Maker.
It's times like those that my life feels really easy XD
Change costumes with equipment!

Forum statistics

Threads
115,948
Messages
1,094,261
Members
151,204
Latest member
Renagade4lyfe
Top