RPG Maker MZ, Preview #3: Character Generator, Plugin Manager, Event: Plugin Command!

Status
Not open for further replies.

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,854
Reaction score
2,797
First Language
French
Primarily Uses
RMMV
I struggle to understand the point?
if you mean that RM offers built-in function? or we write our own function??
also remember that pluginCommand still has to be JsonParsed to work.


@Kaliya I think what they meant is to split a pluginCommand content in multiple function. so the register lambda is not 1000 lines long.

@Anyone yes you can split a lambda. they work as the same as ANY function they can receive/ transfert and EMIT information like ANY normal function so YES splitting a function is possible your way is justy counter intuitive. REMEMBER that your command is simply a function and the way you split it is just useless call.

that's how u would do it.
Code:
PluginManager.registerPluginCommand("MyPlugin","MyCommand", args => {
var data = Json.parse(args);
drawActorWindow(200,400,20,15);
displayActorName(data.actors);
displayActorStats(data.actors);
displayActorFace(data.actors);
displayActorPortrait(data.actors);
} );


drawActorName(actorArray) = () => {
 // blah blah you split stuff whatever you want
};
about reusing code of course you can it's all depends on your preferences.

but in the end......it's all depends on how you want to structure your codes.
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
464
Reaction score
200
First Language
English
Primarily Uses
RMMV
For the plugin list. There's no search function for the plugin command depicted in the screenshot, it's a list. The two things are seperate things. Whether a search function to find plugins exists is entirely irrelevant to the question of whether plugins can can be string searched in the plugin command list.
I don't think it's irrelevant. Note that every list view in RMMV supports Ctrl+F. You can use CTRL+F when selecting a switch or variable (assuming you use the Extended Object Selector in Tools -> Options, not sure if that works without that). You can use Ctrl+F in every database tab that has a list. You can use Ctrl+F in the plugin manager. To me, that makes it likely that the Ctrl+F feature is a basic part of RMMV's list view implementation, which means that any new list view added in RMMZ would also support Ctrl+F.
 

Anyone

Veteran
Veteran
Joined
Aug 24, 2019
Messages
191
Reaction score
201
First Language
German
Primarily Uses
RMMV
I struggle to understand the point?
if you mean that RM offers built-in function? or we write our own function??
also remember that pluginCommand still has to be JsonParsed to work.
Not sure if you're replying to my post?

My post is related to a pretty long discussion that's about the lack of a plugin interpreter as a backup.
1. RMV has a plugin interpreter. RMZ does not, is uses registered commands. I've written about how that's going to result in tedium of clicking through menus when some commands are much easier and faster to execute via command line. Which is why I wish that the plugin interpreter would remain a backup option.
2. One of the replies to this has been that it would be an incredible amount of extra work to have both a registered plugin command as well as a plugin interpreter, because there'd be some pressure for plugin authors to develop commands for both (rather than picking and choosing themselves).
3. I've provided examples of how I do not believe that it would be a lot of additional work, because in a plugin interpreter, you don't execute all the code. You execute the function that does everything, which contains other functions inside. You feed the code as arguments to the function that you're calling.

As a result, I was under the impression that it's a marginal amount of additional work to use both (if you so choose).

JavaScript:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === 'PluginCommandName') {
        //I am just a link, directing arguments to a function
        //Nothing else happens here, which is why this is really short code
        //the function below me, by being a seperate function, can be called by other commands as well
        //so rather than writing the full code of the myFunction every time, I just call that function
    myFunction(args)
    }
};
Instead of...

JavaScript:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === 'PluginCommandName1') {
        var repetitiveProcess0 = args[0];
        var repetitiveProcess1 = args[1];
        var repetitiveProcess2 = args[2];
        var repetitiveProcess3 = args[3];
        console.log("This is repetitive: " + args[0])     
    }
    if (command === 'PluginCommandName2') {
        var repetitiveProcess0 = args[0];
        var repetitiveProcess1 = args[1];
        var repetitiveProcess2 = args[2];
        var repetitiveProcess3 = args[3];
        console.log("This is really repetitive: " + args[0])     
    }
    if (command === 'PluginCommandName3') {
        var repetitiveProcess0 = args[0];
        var repetitiveProcess1 = args[1];
        var repetitiveProcess2 = args[2];
        var repetitiveProcess3 = args[3];
        console.log("This is super repetitive: " + args[0])     
    }
};
So it's irrelevant whether you call the function from a plugin command or a (non-existant) plugin interpreter). All you have to do is call a function and ensure the correct arguments are given to it.
If you need an object from the database, or an array, or whatever it is you need, you simply pick that up in the command and hand it over, so that at the end of the day, your function is executed and receives identical parameters.

Now Kaliya seems to suggest that there is some issue if you call a function from within a registered command and instead, you'd have to have the entire function written as code inside the command, not as a seperate function by itself that you can call?
Which is very confusing.
 
Last edited:

Cyberhawk

Veteran
Veteran
Joined
Jan 9, 2019
Messages
52
Reaction score
41
First Language
English
Primarily Uses
RMMV
Question relating to porting plugins: Would we see multiple plugins implemented into a core plugin?
an example would be Yanifly's Skill rewards or mastery levels built into skill core.
Question totally unrelated to Code:
Would something like K2loid's MV Thunderdome gradient sheet work in MZ?
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,854
Reaction score
2,797
First Language
French
Primarily Uses
RMMV
@Anyone now I see what you mean well. TBH plugin parameters should be just JSON parsed

but I don't see the problem to splits pluginCommand? I mean we did that when aliasing the PluginCommand in MV so doing so doesn't change anything.

transfering data from a function to another one is simple task. Unless the whole process is Promise based then now I guess it get more complicated?
 

Jwx

Villager
Member
Joined
Apr 27, 2020
Messages
18
Reaction score
7
First Language
Spanish
Primarily Uses
RMMV
Very nice, great features :)
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
Now Kaliya seems to suggest that there is some issue if you call a function from within a registered command and instead, you'd have to have the entire function written as code inside the command, not as a seperate function by itself that you can call?
Which is very confusing.
There is no inherent issue if you call a function from a registered plugin command. I was misunderstanding the issue you were referring to. It would however be silly to call an additional function to do whatever the command needs to do, if the same code does not need to be executed elsewhere. I don't personally think lacking the plugin interpreter is in any form a bad thing, having two ways to do plugin commands would create problems. The new way is more suitable for 99% of users, because while you may feel that it was easy to use, I can assure you that most did not. For things that you think would be easier inputted as a line of strings you could easily also just implement it as a script call instead. Which would give you similar functionality I suppose.

On another note In regards to having to parse the arguments passed to the Plugin Commands, I think there may be a bit of confusion with some people? The arguments are not passed as a string, array, or as pure JSON, but instead as an object.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,854
Reaction score
2,797
First Language
French
Primarily Uses
RMMV
There is no inherent issue if you call a function from a registered plugin command. I was misunderstanding the issue you were referring to. It would however be silly to call an additional function to do whatever the command needs to do, if the same code does not need to be executed elsewhere. I don't personally think lacking the plugin interpreter is in any form a bad thing, having two ways to do plugin commands would create problems. The new way is more suitable for 99% of users, because while you may feel that it was easy to use, I can assure you that most did not. For things that you think would be easier inputted as a line of strings you could easily also just implement it as a script call instead. Which would give you similar functionality I suppose.

On another note In regards to having to parse the arguments passed to the Plugin Commands, I think there may be a bit of confusion with some people? The arguments are not passed as a string, array, or as pure JSON, but instead as an object.
you say they are object but we still have to parse them? it's a little contradictory?
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
@nio kasgami No, not at all. They are passed as an object, just because you need to parse them does not mean my statement is contradictory. As you can see, this is the output of "console.log(args);" for the example I gave previously. It is in fact an object.


Edit: Before anyone ask "why" they are not fully parsed to their respective values, I cannot begin to say as I do not know the design choice as to why it was chosen to not do so. I can only assume that it is because parameters could be used for a variety of reasons, and MZ/The Dev team does not want to assume what the plugin creator wants to use the arguments for, thus leaves it up to us to decide how to handle the parameters.
 
Last edited:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,854
Reaction score
2,797
First Language
French
Primarily Uses
RMMV
@nio kasgami No, not at all. They are passed as an object, just because you need to parse them does not mean my statement is contradictory. As you can see, this is the output of "console.log(args);" for the example I gave previously. It is in fact an object.


Edit: Before anyone ask "why" they are not fully parsed to their respective values, I cannot begin to say as I do not know the design choice as to why it was chosen to not do so. I can only assume that it is because parameters could be used for a variety of reasons, and MZ/The Dev team does not want to assume what the plugin creator wants to use the arguments for, thus leaves it up to us to decide how to handle the parameters.
your reasoning is fair. since technically inside of 'actor' you can do another struct like nested object so parsing it by ourself should work.

thanks for clarifying I was slightly confused when you said they are treated as object haha
 

Lion Blade Soler

Autistic Artist
Veteran
Joined
Mar 15, 2012
Messages
55
Reaction score
48
First Language
Portuguese
Primarily Uses
RMMV
From the perspective of a programmer, I'm actually pleased with what has been revealed so far about programming for MZ. I tried to create a plugin for MV a long time ago, but the lack of z-position/z-depth and the way that Javascript was written for MV made programming very problematic to me. However, it appears that creating a plugin for MZ will be about as easy as creating a script for VX Ace, which is a good thing to me.

About the MZ tilesets and in regard to what Avery and others said much earlier about the tilesets, I personally feel that the MZ tilesets are not bad. If anything, I'll admit that the leaf wall could have looked a bit better, but that doesn't mean that there isn't a fix for that and that the rest of the tiles and tilesets are bad. In comparison to the MV tilesets, the MZ tilesets look more like something from old school JRPG from the 16-bit era, especially with the tilesets displaying a high contrast. By the way, it's technically not too late for the tileset graphics to be fixed, considering that some people believe that there are problems with them. Whether it's done before or after the release of MZ, it can be done with a version update for MZ's RTP. I recall that some of the graphics from MV's RTP and from some DLCs did get version updates depending on the circumstances and on the reasons.

Finally, as I stated in the past, I like small/chibi character sprites for RPG Maker as they remind me of character sprites from old school JRPG from the 16-bit era. However, for the ones that are still not big on small/chibi character sprites, there are software that can help you with making the character sprites to your liking. Of course, I'll admit that I wished that Kadokawa would create a new Character Maker (Character Tsukuru) program as I believe that the Character Maker program would be even better than Game Character Hub as Character Maker can be used to create different graphics for the RPG Maker programs, for the Indie Game Maker, and for Pixel Game Maker. In other words and in case of the RPG Maker programs, a new, more up-to-date Character Maker program could help with creating different character sprites, tilesets, battler graphics, etc.. Granted, the same could be done with other graphic design programs, but not everyone can afford something at the level of Photoshop for game graphic design (I still have CS3 version of Photoshop and Fireworks), and unless I'm mistaken, a new Character Maker program would be more cost-effective than a high-end graphic design software to people that want a quality game graphic design program for a low price.
 

chalkdust

Resource Staff
Restaff
Joined
Mar 23, 2015
Messages
359
Reaction score
548
First Language
English
Primarily Uses
RMMV
It's a little tricky, but it's technically possible to get alternate bodies working in MV without making an entirely new generator folder (assuming the bodies are compatible, of course). You can additional bodies just the same as other parts. You can't select the alternate body in the character generator, but if you save the generator settings to a JSON file and edit that file to reference a different body, then when you load that settings file it will use the alternate body.
There are two methods I use for non-human bodies, no JSON editing required:

1) Best method: Place your alternate bodies in the same folder as the human base, temporarily rename the human base, rename the alternate body (to the default name of the human base). Make your character, then swap the names back to restore the default base.
2) Alternate method: Place the alternate bodies in the "Facial Mark" category and name accordingly. This layer appears directly on top of the body base, so it'll "sandwich" properly with all other parts. Works best for body templates that cover the whole human body. If it doesn't cover the whole human base, you'll get stray pixels from the human base that must be manually removed. Work best with custom gradients.
 

Anyone

Veteran
Veteran
Joined
Aug 24, 2019
Messages
191
Reaction score
201
First Language
German
Primarily Uses
RMMV
@nio kasgami No, not at all. They are passed as an object, just because you need to parse them does not mean my statement is contradictory. As you can see, this is the output of "console.log(args);" for the example I gave previously. It is in fact an object.


Edit: Before anyone ask "why" they are not fully parsed to their respective values, I cannot begin to say as I do not know the design choice as to why it was chosen to not do so. I can only assume that it is because parameters could be used for a variety of reasons, and MZ/The Dev team does not want to assume what the plugin creator wants to use the arguments for, thus leaves it up to us to decide how to handle the parameters.
Okay, to clarify:

The plugin command sends a string as an object called "args" to the registered command.

The plugin parameters set in the event plugin command are the properties assigned to this object.
e.g:
args.Actors
args.State

The value assigned to this property is a string whose contents depend on what type was used in the plugin parameter. (Like how a struct can, as string, contain an array or an object with subarrays etc. - or just a number of text)

As a result, the type of what the property contains can vary depending on the type of the parameter in the event plugin command opens (e.g. @type number, @type actor, @type variable, @type string, etc.)

Depending on the type is, you then convert the properties of the object into the values you wish to use.
JavaScript:
    // Get Arguments
    const actorIds = JSON.parse(args.Actors);
    const stateId = args.State;
The Actor is a string that's meant to be an array (albeit containing only a single value, the string containing the number 1), so you convert it via JSON.parse.
Unparsed:
JavaScript:
const actorIds = args.Actor;
console.log(actorIds); // this returns a string "containing" the array: "["1"]"
Parsed:
Code:
const actorIds = JSON.parse(args.Actors);
console.log(actorIds); //this returns the array ["1"]
Because the type of the property is variable, the devs did not automatically JSON.parse them. We need to use JSON.parse only on parameters we receive that are designed to be objects or arrays, but are send to us as a property of the object whose value is a string.

Consequently if we want to use, say, the stateId as number where the type is number, we'd have to use
JavaScript:
const stateId = Number(args.State);
console.log(args.State); //this is the unchanged value of the property of the args object, and returnes "1", a string
console.log(stateId); //this returns the number 1 which also has the correct type (Number)
You can then do what you want with it, such as sending it onwards to otherFunctions(actorIds, stateId) or manipulate it directly like in the example you gave, which uses:
JavaScript:
actor.addState(stateId);
.

So args is an object, with the parameters as properties, which contain the value/array/number/object picked in the event plugin command for that paramater as string which has to be transformed depending on what the type of the parameter in the event plugin command was, and what you wish to use it for. (Such as making sure numbers are numbers, if you have condition checks that require the type to match (===).

I think I've understood it now?
 

Jitsu

Villager
Member
Joined
Oct 3, 2017
Messages
16
Reaction score
18
First Language
German
Primarily Uses
RMVXA
can we now fix pictures without plugins? Maybe just like "!" does it on parallax?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
464
Reaction score
200
First Language
English
Primarily Uses
RMMV
There are two methods I use for non-human bodies, no JSON editing required:

1) Best method: Place your alternate bodies in the same folder as the human base, temporarily rename the human base, rename the alternate body (to the default name of the human base). Make your character, then swap the names back to restore the default base.
Sure, that would work. The reason I prefer the JSON editing method is because I can keep those saved JSON settings and reload them at any time if I want to tweak the generated character. Having to rename images to do that isn't exactly convenient.

Consequently if we want to use, say, the stateId as number where the type is number, we'd have to use
JavaScript:
const stateId = Number(args.State);
console.log(args.State); //this is the unchanged value of the property of the args object, and returnes "1", a string
console.log(stateId); //this returns the number 1 which also has the correct type (Number)
You do realize that using JSON.parse here is also valid, right?

With MV plugin parameters you can't just JSON.parse everything, because the text, select, and combo types aren't valid JSON; so it's possible that that's still an issue here in MZ plugin commands. I'd hope it's not, though...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,626
Reaction score
13,220
First Language
English
Primarily Uses
RMMV
Y'all done got too smart for me to respond to any of this. (Thanks Kaliya)
Yeah, this is all too deep for me. I'll just wait and see what the documentation says, and what the Japanese team provide as plugin examples, then I'll start hunting around if I have questions that still aren't answered.

I love what I've seen so far, as far as the new way to use plugin commands.
 

Galenmereth

Veteran
Veteran
Joined
May 15, 2013
Messages
2,240
Reaction score
2,059
First Language
English
Primarily Uses
RMMV
I recursively parse deeply nested plugin parameters in MV using MV's struct syntax. I've used this to great effect:

JavaScript:
/**
     * Recursively parse a JSON string and return a JavaScript object
     * @param {string} data JSON string to parse
     * @return {object} Recursively JSON parsed object structure, down to the final string
     */
    function recursiveParseJSON(data) {
        if (_isEmpty(data)) return;

        var parsedData = null;
        try {
            parsedData = JSON.parse(data);
        }
        catch (e) {
            return data;
        }

        var result = undefined;

        if (typeof parsedData == "object") {
            result = Array.isArray(parsedData) ? [] : {};
            var keys = Object.keys(parsedData);
            for (var i=0,n=keys.length; i<n; i++) {
                var key = keys[i];
                result[key] = recursiveParseJSON(parsedData[key], key);
            }
        }
        else {
            result = parsedData;
        }

        return result;
    }
As you can see, if JSON can't parse it, I return the data "raw" if it's not a valid JS object that can be parsed. Here's some example JS output as a result:

1594799871217.png

You may notice the property "Pick one option" being a series of "-", which is one issue with this current naive approach, as this should be an internal "comment" and not parsed. It would be trivial to make a whitelist of property names and have the parser ignore anything not matching it though.
 

Anyone

Veteran
Veteran
Joined
Aug 24, 2019
Messages
191
Reaction score
201
First Language
German
Primarily Uses
RMMV
Yeah, this is all too deep for me. I'll just wait and see what the documentation says, and what the Japanese team provide as plugin examples, then I'll start hunting around if I have questions that still aren't answered.

I love what I've seen so far, as far as the new way to use plugin commands.
Nah, I think I've just managed to confuse everyone about something pretty simple.

What it boils down to is that the new plugin command works exactly as the old one, with 2 minor differences:
- plugin commands are registered instead of added to the plugin interpreter
- the args the "event plugin command" sends to your plugin is no longer a string seperated by whitespace where you use args to get the arguments of the command, but instead args is now an object, and you fetch the values via args."nameOfParameter".
Because this allows more complex things to be sent as argument (such as an object or an array in string form) you may at time have to JSON.parse the value of the property to turn the object/array from a "bluprint in string form" into an actual object/array.

Ultimately you just register commands instead of using an aliased plugin interpreter, and you have to handle the arguments slightly different. At the end of the day, after you've extracted what you needed from the object, the way you then use the values for your code or a function you call is entirely the same.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 3)

Latest Threads

Latest Posts

Latest Profile Posts

Got inspired and started writing a simple tower defence battle system last night :o
Good news! I have located an amazing 3D website called SketchFab that has rotatable renderings of famous statues!
Picked up a physical copy of Megadimension Neptunia VII for the PS4 today. It's pretty good. I'm having a lot of fun with it.
The only upside of this remote semester was the plenty of funny photoshop material those facecams provided. Not that I would do that. Ever.

Forum statistics

Threads
100,516
Messages
976,711
Members
132,080
Latest member
nwr
Top