Plugin Specifications
In RPG Maker MV, you can use JavaScript to create your own plugins. Below is information for developers regarding creating plugins.
The following information is for those developers who want to create original plugins using JavaScript.
Basics
- A plugin's .js file will be placed in the js/plugins folder.
- The editor will write to the js/plugins.js file, storing the name of the plugins that will be used and their parameters.
- In order to limit the scope of variables in plugin scripts, they will all be enclosed in immediate functions.
- UTF-8 will be used for the character code.
Redefining Methods
- Redefine the methods which you want to change the behaviors of after saving to a local variable as necessary.
- To minimize conflicts between plugins, it is best to add behaviors that are as original as possible.
Parameters
- Descriptions for plugins and their parameters displayed in the editor are specified in comments that start with "/*:".
@plugindesc The plugin's description. @author The plugin's author. @param Name of the parameters. @desc Description of the parameters. @default Default values of the parameters. @help A detailed description of the plugin. - Use PluginManager.parameters() to get the parameters specified by the editor.
- All parameters will be treated as strings so convert them as necessary.
Metadata
The [Note] field found in each item of the database can be used to define unique data used with each plugin.
<name:data>
In this way, data which has been written in a fixed format will be automatically developed inside a "meta" variable by standard scripts.
In the case above, the following conditions will be met (objects will be treated as data).
object.meta.name === 'data'
Plugin Command
Plugin commands are used for easily defining unique event processes for plugins. When implementing these, the pluginCommand of the Game_Interpreter class will be redefined in the following way.
var _Game_Interpreter_pluginCommand =Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand = function(command, args) {_Game_Interpreter_pluginCommand.call(this, command, args);// insert additional processing details here};
The contents of the plugin commands called by the user will pass through the function command and args methods. Commands will be strings, and args will be an array of strings. For example, when evaluating whether or not the user has entered in "MyPlugin clear", the following will occur.
if (command === 'MyPlugin' && args[0] === 'clear') {}
Just like the parameters for a plugin, everything will be passed as a string to convert them as necessary.
Multi-language Support
You can specify the language code following the "/*:" in the beginning of the comment block. This will become "/*:ja" when setting this to Japanese. Comment blocks with a language code specified will only be used in that language's editor environment, the unlabeled part (normally English) will be used when a language is not supported.
Codes | Language |
---|---|
ja | Japanese |
fr | French |
de | German |
es | Spanish |
it | Italian |
pt | Portuguese |
ru | Russian |
zh | Chinese |
ko | Korean |