RMMZ How to add Plugin Commands to plugin

Status
Not open for further replies.

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ
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!
 

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
625
Reaction score
159
First Language
English
Primarily Uses
RMMZ
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.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,695
Reaction score
1,113
First Language
Portuguese - Br
Primarily Uses
RMMZ
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)
    });
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ
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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 1, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,585
Latest member
Reversinator
Top