RPG Maker MV just get updated with the new Plugin Manager. You can create powerful plugins like the following one now!
[/url]
An example plugin is available in the attachment and also on [url=https://github.com/orzFly/rpgmaker-mv-plugins/blob/master/plugins/PluginEditorDemo.js]GitHub. This plugin is intended to demonstrate the new Plugin Manager in RPG Maker MV v1.5.0 only so it doesn't have any real functionalities.
(This post is also available on
GitHub which may have a better formatting.)
Group Parameters (@parent)
You can use @parent to set the parent parameter. Just append the name of parent parameter after @parent.
Code:
/*: * @param C:\ * * @param Windows * @parent C:\ * * @param System32 * @parent Windows * * @param notepad.exe * @parent System32 * * @param shell32.dll * @parent System32 * * @param explorer.exe * @parent Windows * * @param D:\ * * @param Documents * @parent D:\ */
[/url]
This won't change the syntax when reading the values in game.
Code:
PluginManager.parameters('TreeDemo')['notepad.exe']
Localization Labels (@text)
The name of the parameter can be different from the name shown in editor now. You can use @text to specify the name shown in editor.
Code:
/*: * @param enable * @text Enable the Quest System * @default true * * @param mainmenu * @text Show in Main Menu * @parent enable */
[url=https://forums.rpgmakerweb.com/attachments/text-png.66247/]
To retrieve the value in game, use the name specified by @param instead @text:
Code:
PluginManager.parameters('TextDemo')['enable']# => "true"PluginManager.parameters('TextDemo')['Enable the Quest System']# => undefined
Typings (@type)
Text
Code:
@type text
This directive will create the edtior for single-line string. Just like all the previous version, this is the very basic one.
If you specify an invalid type or just omit the @type directive, this will be used.
[/url]
Note
Code:
@type note
This directive will create the editor for multi-line string.
[url=https://forums.rpgmakerweb.com/attachments/type-note-png.66254/]
Note: the result of this directive is a JSON-escaped string. This means if you are reading the value in game, you need to JSON.parse it to get the real value.
Code:
var value = PluginManager.parameters('PluginEditorDemo')['Note']console.log(value)# => "Aluxes: Eventually...\nAluxes: I can say something longer than one line!\nAluxes: This is super powerful!\norzFly: Oh well..."console.log(JSON.parse(value))# => Aluxes: Eventually...# => Aluxes: I can say something longer than one line!# => Aluxes: This is super powerful!# => orzFly: Oh well...
Number
Code:
@type number
This directive will create the editor for a number with the up/down spin button.
[/url]
Code:
@max 100@min -100
These two directives can be used to set the range for the parameter.
Code:
@decimals 2
This directive will allow the number to have some decimal places. If this is omitted, the number can only be an integer.
File
Code:
@type file
This directive will create the editor for specifying an image resource or an audio resource.
[url=https://forums.rpgmakerweb.com/attachments/type-file-png.66253/]
Code:
@dir audio/bgm/
This directive will set the base directory for the file so the file picker will be scoped to this directory. This path will not be included in the result.
Code:
@require 1
If this directive is present, the file specified by this parameter will be included in the deployment if "Exclude unused files" is chosen.
Object Selector
Code:
@type animation@type actor@type class@type skill@type item@type weapon@type armor@type enemy@type troop@type state@type tileset@type common_event@type switch@type variable
These directives will create the editor allowing the use to pick an item of the object. The object ID will be the result. If None is chosen, the result will be 0.
[/url]
[url=https://forums.rpgmakerweb.com/attachments/type-variable-png.66259/]
Code:
@require 1
(@type animation only) If this directive is present, the animation specified by this parameter will be included in the deployment if "Exclude unused files" is chosen.
Boolean
Code:
@type boolean
This directive will create the editor with two radio options returning a true/false value. The default labels are "ON" and "OFF".
[/url]
Code:
@on Enable@off Disable
You can override the label with @on and @off directives.
[url=https://forums.rpgmakerweb.com/attachments/type-boolean-custom-png.66251/]
Select
Code:
@type select@option XP@option VX@option VX Ace@option MV
This directive will create a drop-down box allowing the user to pick one from predefined options. The value will be the label of the option.
[/url]
Code:
@type select@option XP@value 1.0@option VX@value 2.0@option VX Ace@value 2.1@option MV@value 3.0
You can also override the value by providing the @value directive for each @option.
Combo
Code:
@type combo@option XP@option VX@option VX Ace@option MV
This directive will create a text box with a drop-down menu allowing the user to type the text on his own. The user also can pick one from predefined options.
@value directives are not supported in Combo mode.
[url=https://forums.rpgmakerweb.com/attachments/type-combo-png.66252/]
List
By append [] to any valid type, the editor will be upgraded to a list type. For example, these directives are all valid.
Code:
@type text[]@type note[]@type number[]@type variable[]@type item[]@type combo[]@type file[]@type struct<Anything>[]
[/url]
Note: the result of this type is a JSON-escaped array of strings. This means if you are reading the value in game, you need to JSON.parse it to get the real value.
Code:
var value = PluginManager.parameters('PluginEditorDemo')['Text List']console.log(value)# => ["orzFly","orzDive","orzSwim"]console.log(value[2])# => ovar realValue = JSON.parse(value)console.log(realValue[2])# => orzSwim
Structure
You can define a structure by starting a new comment block in the file. You can put it after the main comment block. The first line defines the name of this struct ("ItemAward" in the example). You can define parameters like normal inside this structure block.
Code:
/*~struct~ItemAward: * @param Item * @type item * * @param Count * @type number * @min 1 * @max 99 * @default 1 */
You can later use this structure by using a special type:
Code:
@type struct<ItemAward>
[url=https://forums.rpgmakerweb.com/attachments/type-struct-png.66257/]
Note: the result of this type is a JSON-escaped object. This means if you are reading the value in game, you need to JSON.parse it to get the real value.
Code:
var value = PluginManager.parameters('PluginEditorDemo')['Structure']console.log(value)# => {"Text":"orzFly","Note":"\"The quick brown fox jumps over the lazy dog.\\nThe lazy dog jumps over the quick brown fox.\\nThe quick brown fox jumps over the quick brown fox.\\nThe lazy dog jumps over the lazy dog.\"","Number":"233","Item":"1","Animation":"1","File (img/)":"system/GameOver"}console.log(value["Text"])# => undefinedvar realValue = JSON.parse(value)console.log(realValue["Text"])# => orzFly
本贴来自国际rpgmaker官方论坛作者:orzfly处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/introduction-to-the-new-plugin-manager-in-rpg-maker-mv-1-5-0.79764/