Skip to content

Instantly share code, notes, and snippets.

@triacontane
Created November 5, 2020 11:49
Show Gist options
  • Save triacontane/4f780fe0ed8d9275227c475b14125c22 to your computer and use it in GitHub Desktop.
Save triacontane/4f780fe0ed8d9275227c475b14125c22 to your computer and use it in GitHub Desktop.
プラグインコマンドでGame_Interpreterのメソッドを呼ぶ
/*:
* @plugindesc CallInterpreterMethod
* @target MZ
*
* @command COMMAND_SAMPLE
* @text コマンド名称
* @desc コマンドの説明
*
* This plugin is released under the MIT License.
*/
(function() {
'use strict';
PluginManager.registerCommand('CallInterpreterMethod', 'COMMAND_SAMPLE', function() {
console.log(this.eventId());
});
})();
@triacontane
Copy link
Author

プラグインコマンド内でGame_Interpreterのメソッドを呼びたい場合は以下の手順で実行します。

  1. アロー関数ではなく、通常のfunctionでコマンドのコールバックを定義する
  2. するとthisに実行元のGame_Interpreterがバインドされるのでthisから実行する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment