Hello! Can someone teach me how to make the parameter in my plugin be a dropdown menu with my presets?
MZ Dropdown Parameters
Learning JavascriptTo 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:
will give you this in the plugin manager.
will give you this in the plugin manager.
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
Code:
@off
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?
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!
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.
Not sure I understand the question.
You want the user to be able to enter a javascript line that is then interpreted?
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);
}
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/