Adding event commands througth plugins

Discussion in 'Editor Suggestions and Improvement' started by ICF-Soft, Dec 24, 2017.

?

Would you like this feature?

  1. Yes

    6 vote(s)
    100.0%
  2. No

    0 vote(s)
    0.0%
  3. Yes but not important

    0 vote(s)
    0.0%
  1. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    Description of the Feature:
    Adding a new way of creating custom commands throught plugins. These custom commands can have their own parameters and prevent plugin commands to be bad written. The other plugin command version can still be for back compatibility.

    Code for Implementation:
    Inside core scripts should be:
    Code:
    /**
     * Tells that this version allows adding custom commands througth plugins.
     *
     * @static
     * @property allowCustomCommands
     * @type Boolean
     * @final
     */
    Utils.allowCustomCommands = true;
    
    $dataCommands = {};
    Code:
    // Custom Plugin Command
    Game_Interpreter.prototype.command357 = function() {
        if ($dataCommands[this._params[0]] && $dataCommands[this._params[0]][this._params[1]]) {
            $dataCommands[this._params[0]][this._params[1]](this._params[2]);
        }
        return true;
    };
    To add a command througth a plugin you use tags like these inside main block:
    Code:
     * commandKey ICF
     * commandText ICF%1
     * 
     * commandGroup Group 1
     * 
     * command command1
     * commandName Process Selfvariables
     * commandParams struct<something>
     * 
     * commandGroup Group 2
     * 
     * command command2
     * commandName Process Traits
     * commandParams struct<something>
    
    commandKey: A name given to a group of commands. If more than one plugin uses the same all fields will be merged.
    commandText: A name to show in a tab for it's key. If there are too much commands inside a tab a it will being divided into various and a number will be placed for %1 for every one.
    commandGroup: A name to show for a group of commands. Commands must be inside groups.
    command: A name for a function that is called when command is executed.
    commandName: A name to show for a command.
    commandParams: A struct where parameters are taken from. Unlike normal plugin parameters these should be stored as the right data types instead of a text that needs to be parsed.

    And to register inside code you'll use something like this:
    Code:
     if (Utils.allowCustomCommands) {
        $dataCommands.ICF = $dataCommands.ICF || {};
        $dataCommands.ICF.command1 = function(obj) {
            //Some code here
        };
        $dataCommands.ICF.command2 = function(obj) {
            //Some code here
        };
    }
    Mockups:
    Mockup1.png Mockup2.png

    Why is this feature good?
    This feature is great because of the following:
    • Avoids normal plugin command interferences
    • More friendlyness for users
    • Less typing and errors
    • More profesional look

    Possible issues with this feature?
    Issues that might arise from this feature:
    • Maybe it could make too many tags
     
    #1

Share This Page