- Joined
- Dec 4, 2017
- Messages
- 15
- Reaction score
- 9
- First Language
- English
- Primarily Uses
- RMMV
Hello again,
So I am displaying a help window on choice selection for certain Show Choices events. I'm doing this by assigning a new Window_Help instance to the _helpWindow property of the _choiceWindow instance of current Window_Message. This is happening by way of the following functions (the script is heavily simplified from the original to focus on the question at hand):
And this works great. I tried to attach an empty project with a simple demonstration of this script, but the file was too large to upload. Not sure how to shrink it, but using the above code in a plugin with any Show Choices will demonstrate the functionality.
The question I have is, after I display the help window, how do I hide it once a selection in the choice list is made? As you can see above, the createHelpWindow function tries to hide the window if it is passed nothing or an empty array. My hope was that I could put a createHelpWindow() call in some event to cause the window to disappear. Here are some that I've tried:
First I tried the terminateMessage function, since that seemed to be the closest to the "end of message" chain. But when that didn't work, I thought I'd try a little sooner in the event chain, by using the Window_ChoiceList.callOkHandler function.
In addition to the createHelpWindow() call with no arguments, I've also tried to simply _choiceWindow._helpWindow.close() to no avail.
Could anyone shed light on what I'm missing to hide the help window when a selection is made?
Thanks!
Occupant
So I am displaying a help window on choice selection for certain Show Choices events. I'm doing this by assigning a new Window_Help instance to the _helpWindow property of the _choiceWindow instance of current Window_Message. This is happening by way of the following functions (the script is heavily simplified from the original to focus on the question at hand):
Code:
// adding a method to Window_Message to actually create the help window with specified text
// and assign it to the current scene's _choiceWindow._helpWindow property
// passing null or an empty array should result in an empty, hidden message window
Window_Message.prototype.createHelpWindow = function(text) {
var lines = (text && text.length) || 0;
var helpWindow = new Window_Help(lines);
helpWindow.visible = lines > 0;
this._choiceWindow.setHelpWindow(helpWindow);
helpWindow.setText((text && text.join("\n")) || "");
SceneManager._scene.addWindow(this._choiceWindow._helpWindow);
};
// create a default help window so that the updateHelp event will trigger
OT_Testing_Window_Message_createSubWindows = Window_Message.prototype.createSubWindows;
Window_Message.prototype.createSubWindows = function () {
OT_Testing_Window_Message_createSubWindows.call(this);
this.createHelpWindow();
};
// this sets up the help window text for the specified choice
var OT_Testing_Window_ChoiceList_select = Window_ChoiceList.prototype.select;
Window_ChoiceList.prototype.select = function (args) {
OT_Testing_Window_ChoiceList_select.call(this, args);
if (SceneManager._scene._messageWindow && // skip if we don't have a messageWindow yet, such as with the title screen choice list
this._list[this._index]) // skip if we aren't in a valid choice, such as if there is no default choie for the list when it is first created
SceneManager._scene._messageWindow.createHelpWindow([
"Hello", "World", this._list[this._index].name
]); // if everything is ready, build the window for this specific choice
};
The question I have is, after I display the help window, how do I hide it once a selection in the choice list is made? As you can see above, the createHelpWindow function tries to hide the window if it is passed nothing or an empty array. My hope was that I could put a createHelpWindow() call in some event to cause the window to disappear. Here are some that I've tried:
Code:
// trying to clear the help window, method 1
var OT_Testing_Window_Message_terminateMessage = Window_Message.prototype.terminateMessage;
Window_Message.prototype.terminateMessage = function() {
if (this._choiceWindow)
if (this._choiceWindow._helpWindow)
this.createHelpWindow();
OT_Testing_Window_Message_terminateMessage.call(this);
};
// trying to clear the help window, method 2
var OT_Testing_Window_ChoiceList_callOkHandler = Window_ChoiceList.prototype.callOkHandler;
Window_ChoiceList.prototype.callOkHandler = function() {
SceneManager._scene._messageWindow.createHelpWindow();
OT_Testing_Window_ChoiceList_callOkHandler.call(this);
};
In addition to the createHelpWindow() call with no arguments, I've also tried to simply _choiceWindow._helpWindow.close() to no avail.
Could anyone shed light on what I'm missing to hide the help window when a selection is made?
Thanks!
Occupant
Last edited:

