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,339
Reaction score
592
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,339
Reaction score
592
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,339
Reaction score
592
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,339
Reaction score
592
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

just spent FOREVER troubleshooting an issue with my keyboard... turns out the cord was just loose OTL
I count on someone one time, I let them promise something to me, and one week later it's complete silence as I'm completely let down. I hate everything.
Everytime I need to write dialogues I find myself writing new music pieces... what kind of trick is this?!
Me Being Dumb spending hrs trying to figure out Irenas Visual Novel busts plugin..lol. I'm probably missing something stupid and obvious xDD

let the journey begin >w>
X.X ok... I guess I'll just have to think about 48x48 a little differently. Its not "room for more work"..."its room for more detail!...yay"

Forum statistics

Threads
99,218
Messages
963,163
Members
130,806
Latest member
Niickpv90
Top