Introduction to the new Plugin Manager in RPG Maker MV 1.5.0+

Discussion in 'RPG Maker MV Tutorials' started by orzfly, Jun 10, 2017.

  1. orzfly

    orzfly Developer Developer

    Messages:
    18
    Likes Received:
    63
    Location:
    Shanghai, China
    First Language:
    Chinese
    Primarily Uses:
    RMMV
    RPG Maker MV just get updated with the new Plugin Manager. You can create powerful plugins like the following one now!

    cover.png

    An example plugin is available in the attachment and also on 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:\
     */
    tree.png

    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
     */
    text.png

    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.

    type-text.png

    Note
    Code:
    @type note
    
    This directive will create the editor for multi-line string.

    type-note.png

    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.

    type-number.png

    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.

    type-file.png

    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.

    type-animation.png

    type-variable.png

    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".

    type-boolean.png

    Code:
    @on Enable
    @off Disable
    
    You can override the label with @on and @off directives.

    type-boolean-custom.png

    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.

    type-select.png

    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.

    type-combo.png

    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>[]
    
    type-list.png

    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])
    # => o
    
    var 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>
    
    type-struct.png

    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"])
    # => undefined
    
    var realValue = JSON.parse(value)
    console.log(realValue["Text"])
    # => orzFly
     

    Attached Files:

    Last edited: Jun 10, 2017
    #1
  2. djDarkX

    djDarkX Retro & Remastered Music Guru Veteran

    Messages:
    2,671
    Likes Received:
    1,767
    Location:
    Currently unsure...
    First Language:
    Music
    Primarily Uses:
    RMMV
    Wow, that's really amazing. I can't wait to see how new and existing plugins will utilize this. Great job to all the people that worked on getting this done.
     
    #2
  3. nio kasgami

    nio kasgami VampCat Veteran

    Messages:
    8,570
    Likes Received:
    2,333
    Location:
    Canada / Quebec
    First Language:
    French
    @orzfly I LIKE IT! now this a must for a plugin Manager! no need for a JSON likes system! You even introduced Nested system wich is really nice! no need to separate our parameters with "empty" params lol!

    Now I was going to publish a new type who could be used for parameters I am unsure if it's the same than LIST Though!
    Does the List works the same than an array or is different from them?
    (Just asking)

    Also does the type are autoconverted?
    or you still have to convert them yourself?

    Also does the File System support Custom Dir?

    Also peoples make me noticed that we can't seem to use Union Type...
    will it be something implemented in the futur?
     
    Last edited: Jun 10, 2017
    #3
  4. LTN Games

    LTN Games Veteran Veteran

    Messages:
    516
    Likes Received:
    333
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    So we can't set default values for the @type note ?
    Edit: Nevermind, I figured it out. It's just a string with line breaks \n
    Code:
     @param Re-scale Backgrounds
     @parent Resolution Options
     @type note
     @desc This will scale backgrounds to new resolution.
     Default: title:false gameover:false battle:false
     @default "title: false\ngameover: false\nbattle: false"
    Thanks for the awesome update! Now I don't have to make my own external plugin manager. Great work!
     
    Last edited: Jun 10, 2017
    #4
  5. Zeriab

    Zeriab Huggins! Veteran

    Messages:
    1,171
    Likes Received:
    1,134
    Yay! You are awesome <3
     
    #5
  6. DK

    DK Veteran Veteran

    Messages:
    66
    Likes Received:
    53
    Location:
    Russia
    First Language:
    Russian
    Primarily Uses:
    RMMV
    Can I use values from string[] to form a combo box ?

    For example, I want to create a plugin for localize the game. I add "Languages" parameter of string[] type, where the player writes all the languages of the game and from this list the combo box is formed the user selects the main language of the game.
     
    #6
  7. orzfly

    orzfly Developer Developer

    Messages:
    18
    Likes Received:
    63
    Location:
    Shanghai, China
    First Language:
    Chinese
    Primarily Uses:
    RMMV
    Very interesting question. Sadly, it's not possible in 1.5.0.
     
    #7
  8. DK

    DK Veteran Veteran

    Messages:
    66
    Likes Received:
    53
    Location:
    Russia
    First Language:
    Russian
    Primarily Uses:
    RMMV
    Thank you! I hope this opportunity will appear in the future
     
    #8
  9. SumRndmDde

    SumRndmDde Follower of RNGesus Veteran

    Messages:
    223
    Likes Received:
    383
    Location:
    an alternate dimension.
    First Language:
    English
    Primarily Uses:
    RMMV
    This is literally the greatest thing that has been added to RPG Maker MV.
    Thank you! :kaothx:
     
    #9
  10. waynee95

    waynee95 Lunatic Coder Veteran

    Messages:
    555
    Likes Received:
    427
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Okay, I though the new Plugin-Manager Layout and the Find function were awesome, but this here
    is so much more amazing!!! :kaothx:

    Wow, thank you guys!! :kaoluv:
     
    #10
  11. DK

    DK Veteran Veteran

    Messages:
    66
    Likes Received:
    53
    Location:
    Russia
    First Language:
    Russian
    Primarily Uses:
    RMMV
    Will there be a type of color picker in the future?
     
    #11
    Frogboy and SumRndmDde like this.
  12. waynee95

    waynee95 Lunatic Coder Veteran

    Messages:
    555
    Likes Received:
    427
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @DK Yeah a color picker would be cool! :D

    So I got my folder all setup, but how can I set them to be closed per default? All my folders start open.

    EDIT:
    @orzfly
    If you nest parameters the JSON parsing get's really weird.
    The strings appear to be escaped and not in JSON format which is due to multiple use of JSON.stringify, I guess. That requires the string to be parsed recursively.
    Was that on purpose or will that be fixed, because when that will be changed in the future all current plugins will break because then the recursive parsing won't work anymore.

    Also folders do not save their open/close state, what makes them not that great actually. It would be cool, if they were closed by default.
     
    Last edited: Jun 12, 2017
    #12
  13. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    13,141
    Likes Received:
    2,077
    Location:
    Philippines
    First Language:
    Tagalog
    Woah these are awesome and it seems like we can now have array parameters that are easily accessible in the manager. Really awesome update to the plugin manager and plugin making. :)
     
    #13
  14. orzfly

    orzfly Developer Developer

    Messages:
    18
    Likes Received:
    63
    Location:
    Shanghai, China
    First Language:
    Chinese
    Primarily Uses:
    RMMV
    I think I have already said very clearly: Only notes (multi-line string), lists and structs would require JSON.parse. This is intended as the value of everything must be single-line strings due to backwards compatibility.
     
    #14
    waynee95 likes this.
  15. DK

    DK Veteran Veteran

    Messages:
    66
    Likes Received:
    53
    Location:
    Russia
    First Language:
    Russian
    Primarily Uses:
    RMMV
    Now I use that function for deep parse:
    Code:
    DKCore.parseDeep = function(string) {
        try {
            return JSON.parse(string, function(key, value) {
                try {
                    return this.parseDeep(value);
                } catch (e) {
                    return value;
                }
            }.bind(this));
        } catch (e) {
            return string;
        }
    };

    It should not breaks if the developers remove the shielding
     
    #15
    waynee95 likes this.
  16. SumRndmDde

    SumRndmDde Follower of RNGesus Veteran

    Messages:
    223
    Likes Received:
    383
    Location:
    an alternate dimension.
    First Language:
    English
    Primarily Uses:
    RMMV
    Is there any way to make "plugin folders" closed by default?
    It kind of ruins the whole structure they create when they all appear opened by default every time the Plugin Manager is opened. :rswt
     
    Last edited: Jun 12, 2017
    #16
  17. Clock Out

    Clock Out Veteran Veteran

    Messages:
    92
    Likes Received:
    43
    First Language:
    English
    Primarily Uses:
    RMMV
    Maybe structs are the answer to those who want their "folders" closed.
     
    #17
  18. Pikheat

    Pikheat Veteran Veteran

    Messages:
    30
    Likes Received:
    19
    First Language:
    German
    Primarily Uses:
    RMMV
    Thank you! You are great :kaojoy:
     
    #18
    waynee95 likes this.
  19. LTN Games

    LTN Games Veteran Veteran

    Messages:
    516
    Likes Received:
    333
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I agree with @SumRndmDde the parent child tags create a collapsable parameter, but no way to set it to closed be default. Yes structs are great but most definitely no an alternative to setting default collapsed option. As one parent can contain a variety of parameters and creating structs for all them, kind of makes the child parent tag pointless.

    This brings me to another thing that I never tested but can we create structs in a core file and use those structs thrghout all plugins in the game? I find it very inconvenient to have half of my plugin be structs and parmeters, it's really large and can be avoided, at least for those with a core plugin like me.
     
    Last edited: Jun 16, 2017
    #19
  20. Shaz

    Shaz Veteran Veteran

    Messages:
    35,268
    Likes Received:
    9,817
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Holy cow, this is NICE!!!
     
    #20

Share This Page