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

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,708
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,708
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,708
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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
399
Reaction score
221
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

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,708
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
¿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 beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top