RPG Maker Forums

I've written a plugin that allows the player to toggle whether or not the message window is shown, but I have a few concerns about it as it stands.


It has a plugin command so that the game can set the message windows to display again regardless. However, I've used a (semi-)global variable to do this, and I suspect there is a better way that I missed.


Also, I don't have a gamepad, so I'm unsure if my gamepad compatibility is really working.


Feedback on the plugin in general welcome also.


Code in spoiler:

Code:
//=============================================================================
// MessageHide.js                                                             
//=============================================================================
 
/*:
@plugindesc v0.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

@help
Message window visibility is reset to 'on' by bringing up the menu 
or resetting the game, 
as well as by pressing the key a second time.

"key" parameter takes values 0-9, a-z, or any of these: 
tab
enter
shift
ctrl
alt
space
semicolon
comma
period
quote
pageup
pagedown
Or any of these, for gamepad compatibility:
ok
cancel
shift
menu
pageup
pagedown
up
down
left
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.
*/

(function() {
  var params = PluginManager.parameters("MessageHide");
  var pKey = String(params["key"]).toLowerCase();
  
  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";
  
  messageWindowForceShow = false;
  
  //=============================================================================
  // Window Message
  //=============================================================================
  
  var alias_wm_ud = Window_Message.prototype.update;
  Window_Message.prototype.update = function() {
    alias_wm_ud.call(this);
    if (Input.isTriggered("messageHide") === true) {
      this.visible = !this.visible;
    }
    if (messageWindowForceShow === true){
      this.visible = true;
      messageWindowForceShow = false;
    }
  }
  
  //=============================================================================
  // 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") {
        messageWindowForceShow = true;
      }
  }
  
})();

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

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.

Forum statistics

Threads
106,038
Messages
1,018,466
Members
137,821
Latest member
Capterson
Top