Refresh content of windows

Hello, I'm actually Trying to make a Corpse party-like save system 
(http://lparchive.org/Corpse-Party/Update%2002/82-SS3_25.png)
At the top of the save command window there is another window that appears with the save stats if there is a save in the selected slot.

So, my question is: How do I refresh other windows when I refresh the command window?
So when I select another slot, it refresh the window where the selected save data is printed.

Thanks to everyone who will help me ^^
I recently made a custom "all-in-one" main menu, where I need to refresh several windows at once upon cursor changing, and from all the methods I have tried, the easiest and most simple would be to pass all of the windows which need to be refreshed to the command window with the help of an instance variable (with attr_accessor defined for the variable), and just refresh them the same way you do with the help windows, in the 'update_help' method.

If that is not feasible (because you would need to pass a lot of other arguments for the refresh methods, for example), you can make a custom update method for the other windows, and refresh the windows inside that method. Just remember to make a condition for the update method, and only refresh your windows when you really need, or else you will kill your FPS.

Here is an example for the latter:

Spoiler
def update_other_windows if @old_index != @command_window.index @other_window.refresh(arg1,arg2) @old_index = @command_window.index endend
Put this into the 'update' method of your scene class.

The '@old_index' check will prevent unnecessary updates. You will need to initialize that in the 'start' method of your scene.

You can make as many update methods like this as you want, as long as you make a condition for each of them.
when you move to another slot, just call @variable_for_your_window.refresh


replacing @variable_for_your_window with the variable pointing to that window
Well, it does not work for me :/
It tells me that the refresh command does not exist.
Also, what are those two args you put in there?

Here is my full code. I've been on it all day, and I can't figure out what's the matter :/

http://paste.awesom.eu/aDgP
As I wrote, that is just an example.

And you must define a refresh method (or name it however you want) which will redraw the contents of the window yourself too, and call that refresh method from the scene, like the example shows.

The args are examples too, there can be more or even none, depends on your refresh method.

Checked your code...

First, is there any reason you inherited from Window_Command instead of Window_Base for your Window_SaveStatus? Because the way I see it, Window_Base is enough. Change that. Make sure to change the initialization method too, WIndow_Base needs 4 arguments for it's super call (x, y, width and height).

Next, remove the update method from Window_SaveStatus. That method would clear and redraw the window in every single frame, which kills your FPS. Also would draw the same stuff over and over.

There is no @command_windowsave variable anywhere in that window either, so it will give you errors for sure. This is the very reason why I suggested that you do the update in the scene class itself, and not in the window class.

And since you will need to pass the index of the command window to that status window, you will have to add an argument for the refresh method inside Window_SaveStatus, name it 'index', for example.

I see that you don't use brackets for your arguments in that refresh method... Fix that.

In the end your refresh method should look like this:

Spoiler
def refresh(index) contents.clear return if index.nil? draw_party_characters(index,150,50) draw_playtime(index, 250, 50, 100, 1) end
I added the index argument where it is needed. Make sure to add it for the two method calls used too! Also change the @command_windowsave.index in those two methods to index.

When this is done, get to the scene class, and paste this code:

Spoiler
def update super update_other_windowsenddef update_other_windows @old_index = @command_windowsave.index if @old_index.nil? if @old_index != @command_windowsave.index @window_save_status.refresh(@command_windowsave.index) @old_index = @command_windowsave.index endend
And this should make it update itself automatically.

Note that I did not test this, but if you did everything right with your drawing methods, it should work.

Also you should take your time to look up on some coding tutorials. There are quite a lot tutorials about window and scene making, those could help you out a lot!
I did exactly what you told me to do, but RM still says that the method "index" does not exist for Nil::nil::class

Also, if you have any tutorial, i'll take them. My native language is french, and there is no actual Ruby or RGSS french tutorial, and the only Ruby tuts I found were the Ruby on Rails tutorials, and, I might be wrong, but it seemed to me like it wasn't good :/.

EDIT: I finally got this working after 3 days :/. Not exactly what I wanted to do, but it's still good: http://image.noelshack.com/fichiers/2015/30/1437489233-erreur-methode.png

Thank you for helping me anyway!
Congrats!


That's coding, you will have a long and hard time until you learn the basics (meaning not copy/paste parts from existing script, but writing your own code down from scratch).


When you achieve that, it will be much easier and you will code in what you want within way less time.


One of the best tutorial series I saw is from Trihan, and can be find in this section of the forum:


http://forums.rpgmakerweb.com/index.php?/forum/33-learning-ruby-and-rgssx/


It's a pinned topic, so you can't miss it. Contains many great topics.


And there are also other great tutorials in that sub-forum.


You can also find many video tutorials on youtube. Just type in what you want to see (like coding custom scene, etc), and always add the "RPG Maker VX Ace" at the start of your search sequence. Doing this on google will lead you to several dozens of tutorials as well. Just always add RPG Maker to your search sequence, or you can try with RGSS3 too.


I know that DiamondPlatinum made some excellent beginner tutorials on how to make custom windows and scenes, so you could start with those. They are video tutorials on youtube, if I remember right.

Original thread: https://forums.rpgmakerweb.com/threads/refresh-content-of-windows.42499/