MZ Dropdown Parameters

Hello! Can someone teach me how to make the parameter in my plugin be a dropdown menu with my presets?
To make it a dropdown, you give it the @type select annotation. Your presets use @option tags, and you can optionally follow those with a @value tag so that the input value is different to the dropdown item. For example:

1672786297620.png


will give you this in the plugin manager.

1672786415646.png
Thank youuuuuu! what about the radio buttons? I feel like there is a list somewhere I don't know about.
Thank youuuuuu! what about the radio buttons? I feel like there is a list somewhere I don't know about.
There isn't an annotation for radio buttons on multiple entries, but @type boolean gives you radio buttons to select between the true and false options and you can name them with the
Code:
@on
and
Code:
@off
tags.

This topic has a list of the annotations you can use for plugins: https://forums.rpgmakerweb.com/inde...w-plugin-manager-in-rpg-maker-mv-1-5-0.79764/
There isn't an annotation for radio buttons on multiple entries, but @type boolean gives you radio buttons to select between the true and false options and you can name them with the
Code:
@on
and
Code:
@off
tags.

This topic has a list of the annotations you can use for plugins: https://forums.rpgmakerweb.com/inde...w-plugin-manager-in-rpg-maker-mv-1-5-0.79764/
Amazing I bookmarked that page. Now that I know that whats the corresponding constructor for things like the booleans.

for example:

@param x position
has the corresponding constructor (I hope that's the right term)
LadyLegend.myplugin._Xpos = Number(parameters["x position"]);

is it boolean where Number is? I haven't tried it I'm just inquiring because I know I'll need it in the future.

There's only 3 types right? Numbers Strings and Boolean?
Amazing I bookmarked that page. Now that I know that whats the corresponding constructor for things like the booleans.

for example:

@param x position
has the corresponding constructor (I hope that's the right term)
LadyLegend.myplugin._Xpos = Number(parameters["x position"]);

is it boolean where Number is? I haven't tried it I'm just inquiring because I know I'll need it in the future.

There's only 3 types right? Numbers Strings and Boolean?
Primitive types, yes. Though the parameters themselves only evaluate to strings; you have to convert them into other types via casting, eval, or JSON.parse.

One of the first things I do when working on any plugin project is to write a function that will automatically convert parameters to their appropriate types, and extract nested elements like arrays and key-value pairs.
Primitive types, yes. Though the parameters themselves only evaluate to strings; you have to convert them into other types via casting, eval, or JSON.parse.

One of the first things I do when working on any plugin project is to write a function that will automatically convert parameters to their appropriate types, and extract nested elements like arrays and key-value pairs.
@_@
ok I will have to circle back to this thread cause I'm not ready for that ATM the automatic conversion sounds boss but you answered my inquiry and that's all I can focus on now thanks again!
@_@
ok I will have to circle back to this thread cause I'm not ready for that ATM the automatic conversion sounds boss but you answered my inquiry and that's all I can focus on now thanks again!
I've made a free Plugin for Plugin Developers that has an inbuilt automatic conversion.
Plugin for Plugin Developers

Simply hand the parameters to ANY_importJS() and it will automatically convert all of them, no matter how deeply nested.
I've made a free Plugin for Plugin Developers that has an inbuilt automatic conversion.
Plugin for Plugin Developers

Simply hand the parameters to ANY_importJS() and it will automatically convert all of them, no matter how deeply nested.
I'm definitely not savvy enough to use this maybe in the future I'm just beginning. I kinda want to learn the hard way and then find out the easier way.
I'm definitely not savvy enough to use this maybe in the future I'm just beginning. I kinda want to learn the hard way and then find out the easier way.

I do have another question about params:

I want the users to be able to input to the parameter lets say:
$gameParty.leader()._battlerName;
I set it up like this:
LadyLegend.myplugin._HUDcg = String(parameters["Center Graphic"]);
but doing so doesn't work out in lets say this:
this.actor = new Sprite(ImageManager.loadSvActor(LadyLegend.myplugin.HUDgu));
I'm assuming because its a string adds the "" to it;
I also tried making a variable and eval it but it didn't work either. You mentioned other conversions like casting and JSON.Parse is that what I need here and if so how do I do that?
Not sure I understand the question.

You want the user to be able to enter a javascript line that is then interpreted?
1673028961577.png

Which is then used to get the image name of the SV Actor you wish to load?

If so, that string needs to be evaluated. There's non eval methods for this in my plugin above (everything's documented and has tutorial plugins).

If you wish to use the eval method (usually to be avoided in online environments due to safety risks) then you need to evaluate the string.
JavaScript:
const UserParameter = "$gameParty.leader()._battlerName"


LadyLegend.myplugin.getLadyLegendSprite = function () {
    const filename = eval(UserParameter);
    const bitmap = ImageManager.loadSvActor(filename)
    return new Sprite(bitmap);
}
This uses the eval to turn the string into interpreted code that will then return the name. The name is then used to load the bitmap, which is then used to create a sprite.
The function above directly hands you the sprite, which you can then use for whatever.

e.g.
JavaScript:
LadyLegend.myplugin.mySprite = LadyLegend.myplugin.getLadyLegendSprite();
Not sure I understand the question.

You want the user to be able to enter a javascript line that is then interpreted?
View attachment 249868
Which is then used to get the image name of the SV Actor you wish to load?

If so, that string needs to be evaluated. There's non eval methods for this in my plugin above (everything's documented and has tutorial plugins).

If you wish to use the eval method (usually to be avoided in online environments due to safety risks) then you need to evaluate the string.
JavaScript:
const UserParameter = "$gameParty.leader()._battlerName"


LadyLegend.myplugin.getLadyLegendSprite = function () {
    const filename = eval(UserParameter);
    const bitmap = ImageManager.loadSvActor(filename)
    return new Sprite(bitmap);
}
This uses the eval to turn the string into interpreted code that will then return the name. The name is then used to load the bitmap, which is then used to create a sprite.
The function above directly hands you the sprite, which you can then use for whatever.

e.g.
JavaScript:
LadyLegend.myplugin.mySprite = LadyLegend.myplugin.getLadyLegendSprite();
I actually got it to work. for some reason the String was set to Object. like whaaaat I never event used the word object.

I thought I deleted the problem as well.... Oh it was a reply directly to use and not a post. Thank you though you got my much further in my plugin than I ever dreamed.

Original thread: https://forums.rpgmakerweb.com/threads/dropdown-parameters.153739/