// DarkPlasma_InputSequentialCommand 1.1.0 // Copyright (c) 2025 DarkPlasma // This software is released under the MIT license. // http://opensource.org/licenses/mit-license.php /** * 2025/04/02 1.1.0 バッファサイズ設定を追加 * 1.0.0 公開 */ /*: @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @plugindesc A series of command inputs @author DarkPlasma @license MIT @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/DarkPlasma-MZ-Plugins ). Original plugin by DarkPlasma. Please check the latest official version at: https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release ----- version: 1.1.0 Allows you to check a sequence of command inputs. Input.clearBuffer(): void Initializes the command input buffer. Input.isSequentialInputted(command: string[]): boolean Determines whether a command sequence has been input last. @param bufferSize @text Command Buffer Size @desc Specifies the size of the command buffer to be remembered. @type number @default 10 */ /*:ja @plugindesc 一連のコマンド入力 @author DarkPlasma @license MIT @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @param bufferSize @desc 記憶するコマンドバッファのサイズを指定します。 @text コマンドバッファサイズ @type number @default 10 @help version: 1.1.0 一連のコマンド入力をチェックできます。 Input.clearBuffer(): void コマンド入力バッファを初期化します。 Input.isSequentialInputted(command: string[]): boolean コマンド列が最後に入力されたかどうかを判定します。 */ (() => { 'use strict'; const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () { return arguments[1]; }); const pluginParametersOf = (pluginName) => PluginManager.parameters(pluginName); const pluginParameters = pluginParametersOf(pluginName); const settings = { bufferSize: Number(pluginParameters.bufferSize || 10), }; function Input_SequentialCommandMixIn(input) { const _initialize = input.initialize; input.initialize = function () { _initialize.call(this); this.clearBuffer(); }; input.clearBuffer = function () { this._commandBuffer = []; }; input.isSequentialInputted = function (command) { const lastInputted = this._commandBuffer.slice(-command.length); if (lastInputted.length !== command.length) { return false; } for (let i = 0; i < command.length; i++) { if (lastInputted[i] !== command[i]) { return false; } } return true; }; const _update = input.update; input.update = function () { _update.call(this); for (const name in this._currentState) { if (this._currentState[name] && this._pressedTime === 0) { this._commandBuffer.push(name); if (this._commandBuffer.length > settings.bufferSize) { this._commandBuffer.splice(-settings.bufferSize); } } } }; } Input_SequentialCommandMixIn(Input); })();