Refresh a variable value on window

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,338
Reaction score
591
First Language
Portuguese - Br
Primarily Uses
RMMV
I see in the other post that you made a little snippet for your window. So, I think you can just use the update function of the window, right?
Or perhaps, call the map refresh function?
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
I see in the other post that you made a little snippet for your window. So, I think you can just use the update function of the window, right?
Or perhaps, call the map refresh function?
¿how do I call the map refresh function? I have tried using Scene_Map.prototype.updateScene but I am not sure where to call it correctly or how to call it, and tried many different ways and positions.
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,338
Reaction score
591
First Language
Portuguese - Br
Primarily Uses
RMMV
try this on the console or in a script call:
$gameMap.refresh()

or

$gameMap.requestRefresh()
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
try this on the console or in a script call:
$gameMap.refresh()

or

$gameMap.requestRefresh()
Did both on the script call of the sprite that activates the event, and ... nope ... ¿is there a way I can create a function that sorts of "recreates" the window with the new information?
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,338
Reaction score
591
First Language
Portuguese - Br
Primarily Uses
RMMV
I don't think you need to recreate the window for this.
Take a look at the core files and search for the help window.
You can make a similar copy and use it as your window.
Add it to the scene map, and call the update in the Update function of the scene map.
You can even, not add it in the update function of the map, but call it with a script or plugin command.
Since the help window can show variables value with escape characters, you should be fine using them.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
I don't think you need to recreate the window for this.
Take a look at the core files and search for the help window.
You can make a similar copy and use it as your window.
Add it to the scene map, and call the update in the Update function of the scene map.
You can even, not add it in the update function of the map, but call it with a script or plugin command.
Since the help window can show variables value with escape characters, you should be fine using them.
¿And what exactly is a help window? If you noticed, I have been using Window_Base and that's it, have not gone deeper and it's particularly because, to my mindset, if I cannot refresh this simple kind of window, later one it might be painful.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
394
Reaction score
213
First Language
English
Primarily Uses
RMMV
You've said you're using Window_Base, but in your other thread you're using Window_Selectable.

Regardless, a simple refresh function might look something like this:

Code:
Window_Custom.prototype.refresh = function() {
    this.contents.clear();
    this.drawContents();
};
Replace "Window_Custom" with your window's name. Replace "drawContents" with the method you use to draw the window's contents in the first place. I'll leave it to you to call this function at an appropriate time because I don't know what you're trying to achieve.
 

Ozenky

Villager
Member
Joined
Sep 21, 2018
Messages
22
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
You've said you're using Window_Base, but in your other thread you're using Window_Selectable.

Regardless, a simple refresh function might look something like this:

Code:
Window_Custom.prototype.refresh = function() {
    this.contents.clear();
    this.drawContents();
};
Replace "Window_Custom" with your window's name. Replace "drawContents" with the method you use to draw the window's contents in the first place. I'll leave it to you to call this function at an appropriate time because I don't know what you're trying to achieve.
I just want that, when I change a Self Switch status, a window shows up or closes. I know that the Self Switch changes value from TRUE to FALSE, but the value (which I show on a screen) is not refreshed. And I have an update function, but inside there is no "this.contents.clear()" or "this.drawAllItems()". Tried to put only this two inside my function and didn't work. It is not refreshing until I change map either.

I am just checking, ¿it is because I am using Scene_Map to show the Window that it doesn't close? ¿Do I have other scene option or scene update method?
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,338
Reaction score
591
First Language
Portuguese - Br
Primarily Uses
RMMV
¿And what exactly is a help window? If you noticed, I have been using Window_Base and that's it, have not gone deeper and it's particularly because, to my mindset, if I cannot refresh this simple kind of window, later one it might be painful.
Not at all. You can make a simple copy of the Window_Help and change the name. It's a little part of the code, so you can see the function to set the text and the function that update it.

It also can go with the approach of Silva.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"
Stream is a bit late but will be live shortly with some game development! Feel free to drop by!
omg, why persona 5 is so good?

Forum statistics

Threads
99,154
Messages
962,384
Members
130,723
Latest member
Yrythaela
Top