MZ How to add Plugin Commands to plugin

Hi,

I searched a bit but couldn't find any info.

I'm used to writing plugins and adding plugin commands like we did in MV, but I have no idea how to take advantage of the new MZ plugin command feature. How do I make it so a plugin command appears in the editor in the plugin command tab?

Thanks!
I learned by looking at other plugins. Not sure which I looked at originally, but I have a Plugin Command in my Preemptive Surprise Plugin, if you wish to take a look at the code and replicate: TDW Preemptive Surprise

Basically you need to set a @command as you would parameters, define @arg, then you need to actually register the command via PluginManager.registerCommand.
Hi there!
It's very simple, you add the commands like parameters:

@command nameOfTheCommand // command
@text 'This is my plugin command'
@ desc

@arg value1 // argument 0
@text
@ desc

@arg value2 // argument 1
@text
@ desc


And then you register it via code:

JavaScript:
    PluginManager.registerCommand(pluginName, nameOfTheCommand , args => {
        const arg0 = Number(args.value1 );
        const arg1 = Number(args.value2 );
        myFunction(arg0, arg1)
    });
Thank you everyone! It works perfectly!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-plugin-commands-to-plugin.127365/