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,282
Reaction score
545
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,282
Reaction score
545
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,282
Reaction score
545
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
212
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,282
Reaction score
545
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

I decided to rework my main character's portrait and logo at the same time....


Honestly I was going to use a lot more yellow in the game along with red and white to represent characters.... But yellow really is just like.... the ugliest color in the color pie. So er... I'm going to use blues/purples in place of it. :LZSwink:
XwwX OMG! Only 4 more weeks till I can leave my crappy job and never ever go back! I am SO freaking excited!!!
Sometimes, it's so hard to resist
"this boss is too easy, what if I add more gimmicks". Then I remember most of my players might be already dying fighting the boss.
You certainly should show love and recognition to teammates who have achieved great success! Congrats Eli!
Just 2 Days of no Internet and I made more Progress in my Game than last 2 Weeks combined. Now I know, Internet makes me a Lazy person.. :D

Forum statistics

Threads
98,076
Messages
949,098
Members
129,358
Latest member
AbidNaga
Top