SHARE
TWEET

NumberInputMax

Astfgl Jun 5th, 2017 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Number input maximum
  3. // by Astfgl
  4. // Date: 05/06/2017
  5. // Free to use both commercially and non commercially, no credits required.
  6. // Edits and redistribution allowed as long as kept under the same terms of use.
  7. // Do not remove this header, do not claim as your own.
  8. //=============================================================================
  9.  
  10. /*:
  11.  * @plugindesc Allows setting a maximum number to number input
  12.  * @author Astfgl
  13.  * @help To set a maximum use the following command:
  14.  * $gameMessage.setNumInputMax(number)
  15.  *
  16.  * Ex: $gameMessage.setNumInputMax(100)
  17.  *
  18.  * To remove the maximum use the following command:
  19.  * $gameMessage.removeNumInputMax();
  20. */
  21.  
  22. (function(){
  23. var _Astfgl_newWNICD = Window_NumberInput.prototype.changeDigit
  24.  
  25. Window_NumberInput.prototype.changeDigit = function(up) {
  26.     _Astfgl_newWNICD.call(this,up);
  27.     if (this._maxNumber) {
  28.         if (this._number > this._maxNumber) {
  29.         this._number = this._maxNumber;
  30.         this.refresh();
  31.         }
  32.     }
  33. }
  34.  
  35. Game_Message.prototype.setNumInputMax = function(max) {
  36.     SceneManager._scene._messageWindow._numberWindow._maxNumber = max
  37. }
  38.  
  39. Game_Message.prototype.removeNumInputMax= function() {
  40.     delete SceneManager._scene._messageWindow._numberWindow._maxNumber
  41. }
  42. })()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top