Write a plugin's source
write_plugin_sourceCreate or replace a JavaScript plugin file for an RPG Maker MZ project, optionally enabling it in the plugin list. Changes are journaled for undo.
Instructions
Create or replace js/plugins/<name>.js. This is Unity's manage_script equivalent, with one difference that matters for the loop: MZ plugins are plain JavaScript loaded at boot, so there is no compile step to wait for — the file is live the moment a game starts. The write is journaled, so undo_writes takes it back, and js/plugins.js is not touched unless enable is set. With enable the plugin is added to the editor's list (or switched on if it is already there) and its parameters filled from the @default values in the header it was just given, which means the header has to be written first for the parameters to be anything. A game already running will not pick any of this up: restart it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | File name without extension; no path separators | |
| text | Yes | ||
| enable | No | ||
| parameters | No | Parameter values to store when enabling, overriding the header defaults |