じ☆ve冰风 发表于 2026-7-16 19:04:41

TSR_NumPad





Authors
Initial idea: @ShadowDragon
programming: TSR

download
TSR_NumPad

This plugin replace the default number input process with a numeric pad where digits are input from right to left like a classic calculator. Navigate the pad with keyboard arrows or mouse, or directly type the digits on the keyboard to input numbers in game.

HOW TO USE:

   -Install the plugin in your Plugin Manager
   -Use the default event command: 'Number Input Process'

Same as default, set the max digits and the game variable ID that will store the input number. Once you confirm and close
the number input pad, the returning value will be stored in that game variable.


The numeric pad will adjust to the position of the message window.








https://forums.rpgmakerweb.com/attachments/capture-de-cran-le-2023-02-05-a-13-22-56-png.252984/



The plugin also provide a few additionnal features like the possibility to input negative and floating values.








All settings are done using plugin commands so each time you need a number input, the numeric pad can be set as needed.
For further details, consult the plugin instructions:
Spoiler: Instructions                Code:       
* ===================================================================================
* == About this Plugin ==============================================================
* ===================================================================================
* This plugin replace the default number input process with
* a numeric pad. Navigate the pad with keyboard arrows or
* mouse, or directly type the digits on the keyboard to
* input numbers in game.
*
* HOW TO USE:
*
*      -Install the plugin in your Plugin Manager
*      -Use the default event command: 'Number Input Process'
*
* Same as default, set the max digits and the game variable ID
* that will store the input number. Once you confirm and close
* the number input pad, the returning value will be stored in
* that game variable.
*
*
* Using plugin commands, you can set 3 different layouts for the
* numeric panel:
*
* Layout 1
* ========
* This is the basic layout:
*
*   123
*   456
*   789
*   C0Ok
*
* Buttons:
*    Digits = input a digit
*            Ok = confirm the input and close
*               C = delete last digit, close if no inputs
*
*
* Layout 2
* ========
* This layout allow to return negative values.
*
*   123C
*   456AC
*   789+/-
*       0   Ok
*
* Additional buttons:
*            AC = delete all digits, close if no inputs
*             +/- = toggle On/Off the minus sign, return
*                   negative values when On
*                  
*
* Layout 3
* ========
* This layout add the dot (.) button to turn the
* number into a floating value.
*
*   123C
*   456AC
*   789+/-
*   .0   Ok
*
* Additional button:
*            . = input a dot to turn the number into a
*                  floating value***
*
*
*    *** Floating value ***
*
*The input number is returned inside a game variable.
*By default game variables cannot stored floating numerical
*values, so when the input number is a floating value, the
*plugin will return the value as a string (text), see bellow.
*
*******************************************************
*
*
*
* Plugin commands
* ===============
*
*   -Number input layout:
*          Select between one of the 3 layouts described above
*
*
*   -Number input font face:
*          Select between the main font face or the number font
*          face for the number input windows.
*
*            *the main font face and the number font face are
*               the 2 default font faces set in the data base.
*
*
*   -Input leading zeros:
*          If you want the returning combination to includes '0'
*          in front, like: 0246, you can enable the leading zeros.
*          Note that in this case the returning value will be a
*          string (text), see bellow.
*         
*
*   -Number input auto close:
*          When enabled, the number input windows will automatically
*          confirm and close when the last digits is input.
*
*            Ex:
*            You have set the maximum digits to 4.
*            The number input process will close as
*            soon as a fourth digit is input.
*         
*
*   -Revert digits layout:
*          Revert the first and second digits rows.
*
*         revert      no revert
*          789         123
*          456         456
*          123         789
*
*
*
*   ** String values **
* **********************************************************
* When the returning value is a string, you cannot directly
* compare it to a numerical value, and math operations using
* a string value might render unexpected results.
*
* A string value can be convert to a numerical value using
* the parseInt method in js.
*
*    Ex: parseInt('123') = 123
*
* But doing that will remove any leading zeros and round up
* floating values.
*
* The parseFloat method can be use for returning the floating
* value of a string.
*
*    Ex: parseFloat('0.56') = 0.56
*
*
* For direct comparison, you can simply check if the returing
* value is equal to the corresponding string (between quotes).
*
*    Ex: If the returning value is '00456' and is stored
*      in the game variable X.
*
*      You can check if:
*          $gameVariables.value(X) === '00456'
*
*
* Important notes:
*
*   -Float
*         If you're using the Layout 3. The returning value
*         will be a string only if it contains a dot ('.').
*         Otherwise it will return a numerical value.
*
*   -Leading zeros
*         If you have enabled the 'Leading zeros' option, the
*         returning value will always be a string, even if it
*         doesn't contains any leading zeros.
*
* **********************************************************


                Code:       
* ================================================================================
* == Term of Usage ===============================================================
* ================================================================================
*
* Use in any independant RPG Maker MZ projects, including commercials.
*
* Credit is required for using this Plugin.
* For crediting, use 'TSR' along with one of
* the following terms:
*      'The Northern Frog' or 'A frog from the north'
*
* Do not change the Header or the Terms of usage.
*
* You can edit it as you like for you project.
*
*
* DO NOT REDISTRIBUTE!
* If you want to share it, share the link to my itch.io account:
* https://the-northern-frog.itch.io/
*
*
* ================================================================================


Happy game dev!
Regards.
TSR
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7


本贴来自国际rpgmaker官方论坛作者:TSR处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/tsr_numpad.154887/
页: [1]
查看完整版本: TSR_NumPad