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,685
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
629
Reaction score
162
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,709
Reaction score
1,127
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,685
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: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,472
Members
137,822
Latest member
madelbylz
Top