Message Window Hide

Jatopian

Veteran
Veteran
Joined
Jul 5, 2015
Messages
47
Reaction score
14
First Language
English
Primarily Uses
Message Window Hide
by Jatopian​

Introduction
This plugin lets the player toggle whether or not the message window is shown, by pressing a key.

Features
+ Lets the player get a better look at your beautiful graphics in cutscenes.
+ Developer can configure what key is used to toggle.
+ Plugin command allows game events to turn message window back on - can be used to help with forgetful players wondering why they can't see NPC dialogue.
+ For even more foolproof design, a config option lets the developer have the message window automatically return on each new page of text.

How to Use
Should be straightforward plug&play. Key that activates the feature is configurable as a parameter. I'm not aware of any bugs or compatibility issues.

Terms of Use
* Free for commercial and non-commercial use.
* Please give credit in a trivially accessible place.
* OK to modify, but if you redistribute the modified version, please make clear that you modified it, and how.
* If you add features that could be useful to others, please at least consider sharing them with the community.

Code:
//=============================================================================
// MessageHide.js                                                            
//=============================================================================
 
/*:
@plugindesc v1.1.0 Define a key the player can press to toggle whether the message window is shown.
@author Jatopian

@param key
@desc Key that toggles message window visibility when pressed. See help for list.
@default ctrl

@param show on new page
@desc Whether the message window automatically becomes visible on a new page of dialogue. true / false
@default false

@help
Message window visibility is reset by pressing the key again,
or resetting the game.
Game events can also make it happen with plugin command: ShowMessageWindow
With "show on new page" param true,
visibility is reset for each new message window page.

"key" parameter takes values:
a-z
0-9
tab
enter
shift
ctrl
alt
space
semicolon
comma
period
quote
And also gamepad-compatible values:
ok       //      A
cancel   //      B
shift    //      X
menu     //      Y
pageup   //      LB
pagedown //      RB
up       //      D-pad up
down     //      D-pad down
left     //      D-pad left
right    //      D-pad right

Terms of Use:
- Free for commercial and non-commercial use.
- Please give credit in a trivially accessible place.
- OK to modify, but if you redistribute the modified version,
  please make clear that you modified it, and how.
- If you add features that could be useful to others,
  please at least consider sharing them with me and the community.

Changelog:
1.1.0:
Show/hide now persists between maps and when bringing up the menu.
"show on new page" feature.
*/

(function() {
  var params = PluginManager.parameters("MessageHide");
  var pKey = String(params["key"]).toLowerCase();
  var pNewPage = (function() { 
    var p = String(params["show on new page"]).toLowerCase();
    if (p.match(/true/i)) {
      return true;
    } else if (p.match(/false/i)) {
      return false;
    } else {
      return Utils.isNwjs();
    }
  })();
 
  var key_ids = {
    "tab":9,"enter":13,"shift":16,"ctrl":17,"alt":18,"space":32,
    "0":48,"1":49,"2":50,"3":51,"4":52,"5":53,"6":54,"7":55,"8":56,"9":57,
    "a":65,"b":66,"c":67,"d":68,"e":69,"f":70,"g":71,"h":72,"i":73,"j":74,"k":75,"l":76,"m":77,
    "n":78,"o":79,"p":80,"q":81,"r":82,"s":83,"t":84,"u":85,"v":86,"w":87,"x":88,"y":89,"z":90,
    "semicolon":186,"comma":188,"period":190,"quote":222,
  };
 
  Input.keyMapper[key_ids[pKey]] = "messageHide";
 
  //global variables!
  MessageHide_messageWindowShowNext = false;
  MessageHide_messageWindowVisible = true; //global to persist between maps
 
  //=============================================================================
  // Window Message
  //=============================================================================
 
  var alias_wm_ud = Window_Message.prototype.update;
  Window_Message.prototype.update = function() {
    alias_wm_ud.call(this);
    if (MessageHide_messageWindowShowNext === true) {
      MessageHide_messageWindowVisible = true;
      MessageHide_messageWindowShowNext = false;
    } else if (Input.isTriggered("messageHide") === true) {
      MessageHide_messageWindowVisible = !MessageHide_messageWindowVisible;
    }
    this.visible = MessageHide_messageWindowVisible;
  }
 
  var alias_wm_np = Window_Message.prototype.newPage;
  Window_Message.prototype.newPage = function(textState) {
    alias_wm_np.call(this, textState);
    if (pNewPage) MessageHide_messageWindowVisible = true;
  }
 
  //=============================================================================
  // Game Interpreter
  //=============================================================================
 
  var alias_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  Game_Interpreter.prototype.pluginCommand = function(command, args) {
      alias_Game_Interpreter_pluginCommand.call(this, command, args);
      if (command === "ShowMessageWindow") {
        MessageHide_messageWindowShowNext = true;
      }
  }
 
})();
 
Last edited:

Jatopian

Veteran
Veteran
Joined
Jul 5, 2015
Messages
47
Reaction score
14
First Language
English
Primarily Uses
In response to some private feedback, I have updated the script to version 1.1.0.

The message window no longer resets to visibility on opening the menu or changing maps.

I have also added a config option that makes the message window automatically return on each new page of text, for devs extra worried about forgetful players.
 
Last edited:

phamtruong1992

Green Dragon
Veteran
Joined
Nov 22, 2015
Messages
196
Reaction score
220
First Language
English
Primarily Uses
RMMV
It sounds interesting so i downloaded it for testing purpose, but it didn't work anymore, dude. I'm kind of wanting to see it in action too.
 

Jatopian

Veteran
Veteran
Joined
Jul 5, 2015
Messages
47
Reaction score
14
First Language
English
Primarily Uses
It sounds interesting so i downloaded it for testing purpose, but it didn't work anymore, dude.
The last version was included in a commercial project, so a lot of players tested it. I do not know why it does not work for you, but you may want to try the plugin support forum, paying special attention to this thread.
 

phamtruong1992

Green Dragon
Veteran
Joined
Nov 22, 2015
Messages
196
Reaction score
220
First Language
English
Primarily Uses
RMMV
Wow, 1 like for your quick reply. I guess I will have to try to turn off some related plugins to see if it works.
 

mdqp

Veteran
Veteran
Joined
Jun 2, 2014
Messages
45
Reaction score
8
First Language
Italian
Primarily Uses
Hello there! I like this script a lot and I am considering using it. Am I right that to make it work with Yanfly's message plugin, I'd just need to alias his "name window" in a manner similar to how you alias the message box, so that both disappear when the right key is pressed?

Edit: I figured it out on my own! Thanks again for this great plugin. :)
 
Last edited:

Jatopian

Veteran
Veteran
Joined
Jul 5, 2015
Messages
47
Reaction score
14
First Language
English
Primarily Uses
Hello there! I like this script a lot and I am considering using it. Am I right that to make it work with Yanfly's message plugin, I'd just need to alias his "name window" in a manner similar to how you alias the message box, so that both disappear when the right key is pressed?

Edit: I figured it out on my own! Thanks again for this great plugin. :)
Hey, sorry for not replying. This busy week has been something of a blur for me, and I missed the notification initially. Glad to hear you figured it out! If you don't mind sharing your solution and which Yanfly script you mean, I'd be interested in improving compatibility with Yanfly scripts, as so many people use them.
 

mdqp

Veteran
Veteran
Joined
Jun 2, 2014
Messages
45
Reaction score
8
First Language
Italian
Primarily Uses
Hey, sorry for not replying. This busy week has been something of a blur for me, and I missed the notification initially. Glad to hear you figured it out! If you don't mind sharing your solution and which Yanfly script you mean, I'd be interested in improving compatibility with Yanfly scripts, as so many people use them.
Sure! The problem was with Yanfly's message core. Most of it is fine without changes, but it gives you the option to add a "name window" on top of the normal message window (to show the name of whoever is talking). Since it's a separate window, it didn't hide together with the message window. All I did was copy paste parts of your plugin, and tweak them as needed:

Code:
var alias_wm_nb = Window_NameBox.prototype.update;
  Window_NameBox.prototype.update = function() {
    alias_wm_nb.call(this);
    if (Input.isTriggered("messageHide") === true) {
     this.visible = MessageHide_messageWindowVisible;
    }
  }
I butchered it, as I was just interested in a quick solution to my issue, but it works just fine.
 

Dethroner

Villager
Member
Joined
Jun 21, 2016
Messages
12
Reaction score
3
First Language
Rus
Primarily Uses
RMMV
Hi! Your plugin is just what I need.
But I have a question: is it possible to trigger hide/show window by command or script call without using keys?
Thank you!
 

uuuuuu1515

Warper
Member
Joined
Jul 7, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
Never mind I saw it. Thanks, you guys!
 
Last edited:

cedr777

Lead developer of "Charao Life"
Veteran
Joined
Feb 22, 2018
Messages
241
Reaction score
54
First Language
Not English
Primarily Uses
RMMV
Bug report. Did the code above but sometimes a blank box would appear at the top left of the screen.


Edit: the problem is gone now, I don't know why. Must be another plugin I was using interfering with it.
 
Last edited:

cedr777

Lead developer of "Charao Life"
Veteran
Joined
Feb 22, 2018
Messages
241
Reaction score
54
First Language
Not English
Primarily Uses
RMMV
If anyone is interested, I made a request here, to have this plugin support mouse button right click as if it was in a visual novel.

all credit goes to Magnus0808
 
Last edited:
Joined
Apr 18, 2019
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
Curious if this could be made to be compatible with YEP_KeyboardConfig?
YEP_KeyboardConfig seems to prevent this from working but it does work with the mouse right click support made by Magnus0808 so I suspect something is messing with the input capture.

While playing with this I noticed a problem similar to what cedr777 had posted on Feb 17, 2019 with the odd box in the top corner which seems to be caused by a blank Window_NameBox from YEP_MessageCore being told to be visible. Changed Magnus0808's plugin slightly to correct that issue:

Code:
    if(Imported.YEP_MessageCore){
        var MRP_HIDERIGHTCLICK_WNB_UPDATE = Window_NameBox.prototype.update;
        Window_NameBox.prototype.update = function() {
            MRP_HIDERIGHTCLICK_WNB_UPDATE.call(this);
            if(this._lastNameText != '') // Changed to check if Namebox has content
            {
                this.visible = this._parentWindow.visible;        
            }
        }
    }
Thanks for the nice plugin!
 

cedr777

Lead developer of "Charao Life"
Veteran
Joined
Feb 22, 2018
Messages
241
Reaction score
54
First Language
Not English
Primarily Uses
RMMV
Worked like a charm, thanks.
To those wondering where to put the code. It's supposed to go in MRP_MessageHideOnRightClick.js
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
127
Reaction score
11
First Language
Australian
Primarily Uses
RMMV
Doesn't work with yanfly keyboard config. It would be great if it was fixed :)
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
528
Reaction score
220
First Language
thai
Primarily Uses
RMMV
hi thereportingbug cedr777
I try to edit code like this
but the still there could you please check out what I done wrong
or upload the work version please
thank you

Code:
//=============================================================================
// Message Hide On Right Click
// MRP_MessageHideOnRightClick.js
// By Magnus0808 || Magnus Rubin Peterson
//=============================================================================

var Imported = Imported || {};

/*:
 * @plugindesc MessageHide Extension. Hide message on right click.
 * @author Magnus0808
 *
 * @help Plug and play. Put after MessageHide.
*/

(function(){
    var MRP_HIDERIGHTCLICK_WM_UPDATE_OLD = Window_Message.prototype.update;
    Window_Message.prototype.update = function() {
        MRP_HIDERIGHTCLICK_WM_UPDATE_OLD.call(this);
        this.processRightClick();
    };
    
    Window_Message.prototype.isOpenAndActive = function() {
        return this.isOpen() && this.active;
    };
    
    var MRP_HIDERIGHTCLICK_WM_UPDATEINPUT_OLD = Window_Message.prototype.updateInput;
    Window_Message.prototype.updateInput = function() {
        if(this.pause && this.isTriggered() && !this.visible) {
            return true;
        }
        return MRP_HIDERIGHTCLICK_WM_UPDATEINPUT_OLD.call(this);
    };
    
    Window_Message.prototype.processRightClick = function() {
        if(this.isOpenAndActive() && TouchInput.isCancelled()){
            MessageHide_messageWindowVisible = !MessageHide_messageWindowVisible;
        }
    };
    
    /*if(Imported.YEP_MessageCore){
        var MRP_HIDERIGHTCLICK_WNB_UPDATE = Window_NameBox.prototype.update;
        Window_NameBox.prototype.update = function() {
            MRP_HIDERIGHTCLICK_WNB_UPDATE.call(this);   
            if(this._parentWindow.isOpen())
            {
                this.visible = this._parentWindow.visible;           
            }
        }
    }*/
    if(Imported.YEP_MessageCore){       
       var MRP_HIDERIGHTCLICK_WNB_UPDATE = Window_NameBox.prototype.update;
        Window_NameBox.prototype.update = function() {
            MRP_HIDERIGHTCLICK_WNB_UPDATE.call(this);
            this.visible = this._parentWindow.visible;
            if(this._lastNameText != '') // Changed to check if Namebox has content
            {
                this.visible = this._parentWindow.visible;       
            }
        }
    }   
})();
 
Joined
Apr 18, 2019
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
Well pasunna, it looks like you are setting visibility for the NameBox twice in the block if(Imported.YEP_MessageCore) (1st just going with whatever the parent window is then 2nd doing so only if the NameBox contains something so the 1st will always change visibility regardless of if it should)

Here are the current scripts I have (modified from the originals)

MessageHide.js
Code:
//=============================================================================
// MessageHide.js                                                         
//=============================================================================
 
/*:
@plugindesc v1.1.0 Define a key the player can press to toggle whether the message window is shown.
@author Jatopian

@param key
@desc Key that toggles message window visibility when pressed. See help for list.
@default ctrl

@param show on new page
@desc Whether the message window automatically becomes visible on a new page of dialogue. true / false
@default false

@help
Message window visibility is reset by pressing the key again,
or resetting the game.
Game events can also make it happen with plugin command: ShowMessageWindow
With "show on new page" param true,
visibility is reset for each new message window page.

"key" parameter takes values:
a-z
0-9
tab
enter
shift
ctrl
alt
space
semicolon
comma
period
quote
And also gamepad-compatible values:
ok       //      A
cancel   //      B
shift    //      X
menu     //      Y
pageup   //      LB
pagedown //      RB
up       //      D-pad up
down     //      D-pad down
left     //      D-pad left
right    //      D-pad right

Terms of Use:
- Free for commercial and non-commercial use.
- Please give credit in a trivially accessible place.
- OK to modify, but if you redistribute the modified version,
  please make clear that you modified it, and how.
- If you add features that could be useful to others,
  please at least consider sharing them with me and the community.

Changelog:
1.1.0:
Show/hide now persists between maps and when bringing up the menu.
"show on new page" feature.
*/

var Imported = Imported || {};
Imported.MessageHide = true;

(function() {
  var params = PluginManager.parameters("MessageHide");
  var pKey = String(params["key"]).toLowerCase();
  var pNewPage = (function() {
    var p = String(params["show on new page"]).toLowerCase();
    if (p.match(/true/i)) {
      return true;
    } else if (p.match(/false/i)) {
      return false;
    } else {
      return Utils.isNwjs();
    }
  })();
 
  var key_ids = {
    "tab":9,"enter":13,"shift":16,"ctrl":17,"alt":18,"space":32,"home":36,
    "0":48,"1":49,"2":50,"3":51,"4":52,"5":53,"6":54,"7":55,"8":56,"9":57,
    "a":65,"b":66,"c":67,"d":68,"e":69,"f":70,"g":71,"h":72,"i":73,"j":74,"k":75,"l":76,"m":77,
    "n":78,"o":79,"p":80,"q":81,"r":82,"s":83,"t":84,"u":85,"v":86,"w":87,"x":88,"y":89,"z":90,
    "semicolon":186,"comma":188,"period":190,"quote":222,
  };
 
  Input.keyMapper[key_ids[pKey]] = "messageHide";
 
  //global variables!
  MessageHide_messageWindowShowNext = false;
  MessageHide_messageWindowVisible = true; //global to persist between maps
 
  //=============================================================================
  // Window Message
  //=============================================================================
 
  var alias_wm_ud = Window_Message.prototype.update;
  Window_Message.prototype.update = function() {
    alias_wm_ud.call(this);
    if (MessageHide_messageWindowShowNext === true) {
      MessageHide_messageWindowVisible = true;
      MessageHide_messageWindowShowNext = false;
    } else if (Input.isTriggered("messageHide") === true) {
      MessageHide_messageWindowVisible = !MessageHide_messageWindowVisible;
    }
    this.visible = MessageHide_messageWindowVisible;
  }

 if(Imported.YEP_MessageCore){
   var alias_wm_nb = Window_NameBox.prototype.update;
   Window_NameBox.prototype.update = function() {
     alias_wm_nb.call(this);
     if (Input.isTriggered("messageHide") === true) {
      if(this._lastNameText != '') // Changed to check if Namebox has content
      {
       this.visible = MessageHide_messageWindowVisible;
      }
     }
   }
 }
 
  var alias_wm_np = Window_Message.prototype.newPage;
  Window_Message.prototype.newPage = function(textState) {
    alias_wm_np.call(this, textState);
    if (pNewPage) MessageHide_messageWindowVisible = true;
  }
 
  //=============================================================================
  // Game Interpreter
  //=============================================================================
 
  var alias_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  Game_Interpreter.prototype.pluginCommand = function(command, args) {
      alias_Game_Interpreter_pluginCommand.call(this, command, args);
      if (command === "ShowMessageWindow") {
        MessageHide_messageWindowShowNext = true;
      }
  }
 
})();
MRP_MessageHideOnRightClick.js
Code:
//=============================================================================
// Message Hide On Right Click
// MRP_MessageHideOnRightClick.js
// By Magnus0808 || Magnus Rubin Peterson
//=============================================================================

var Imported = Imported || {};

/*:
 * @plugindesc MessageHide Extension. Hide message on right click.
 * @author Magnus0808
 *
 * @help Plug and play. Put after MessageHide.
*/

(function(){
    var MRP_HIDERIGHTCLICK_WM_UPDATE_OLD = Window_Message.prototype.update;
    Window_Message.prototype.update = function() {
        MRP_HIDERIGHTCLICK_WM_UPDATE_OLD.call(this);
        this.processRightClick();
    };
 
    Window_Message.prototype.isOpenAndActive = function() {
        return this.isOpen() && this.active;
    };
 
    var MRP_HIDERIGHTCLICK_WM_UPDATEINPUT_OLD = Window_Message.prototype.updateInput;
    Window_Message.prototype.updateInput = function() {
        if(this.pause && this.isTriggered() && !this.visible) {
            return true;
        }
        return MRP_HIDERIGHTCLICK_WM_UPDATEINPUT_OLD.call(this);
    };
 
    Window_Message.prototype.processRightClick = function() {
        if(this.isOpenAndActive() && TouchInput.isCancelled()){
            MessageHide_messageWindowVisible = !MessageHide_messageWindowVisible;
        }
    };
 
    if(Imported.YEP_MessageCore){
        var MRP_HIDERIGHTCLICK_WNB_UPDATE = Window_NameBox.prototype.update;
        Window_NameBox.prototype.update = function() {
            MRP_HIDERIGHTCLICK_WNB_UPDATE.call(this);
            if(this._lastNameText != '') // Changed to check if Namebox has content
            {
                this.visible = this._parentWindow.visible;       
            }
        }
    }

})();
 
Last edited:

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
528
Reaction score
220
First Language
thai
Primarily Uses
RMMV
thank you thereportingbug
sorry I forgot to delete that line I'm testing it
but now I use your code it's still there too
then... I find out...
I have two set of copy of these plugins in my editer -....-
just delet one of them and the problem is solve now
thank you
 

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

Latest Threads

Latest Posts

Latest Profile Posts

The most rewarding part of making custom body character parts is absolutely not making the masks work. Somebody please put me out of my misery.
Any commercial devs here ever mess with Gamejolt? Been contemplating making my games available there but don't know if it's worth the effort or not.
Social distancing taught me of how much of not a loner I am. Dammit, I miss seeing my friends...
Happy 4th of July all. Anybody have plans? Mine here is staying home away from the virus. Still a nice 3 day weekend.
The project I am working on is going great at the moment. I'm hoping everyone is having as successful a time as I am. :)

Forum statistics

Threads
99,258
Messages
963,580
Members
130,850
Latest member
MarcusCryo
Top