Plugin Parameters Generator

Lecode

(─‿‿─)
Veteran
Joined
Dec 18, 2013
Messages
490
Reaction score
659
First Language
French
Primarily Uses
N/A
Getting plugin parameters and writing the help to display them is a chore.


I'm used to define my parameters while coding the plugin.


So I come with a little tool who generate the help text and the final code to get the parameters.


I was using it locally but moved it to github so everyone can use it.


Let's take this example:


While writing your code you defined these parameters:


var parameters = PluginManager.parameters('MagicSteps');

Lecode.MagicSteps.goldGain = 30;
Lecode.MagicSteps.requiredSteps = 5;
Lecode.MagicSteps.allowedMaps = "[2,5,8]";
Lecode.MagicSteps.windowTitle = "Magic Steps Effects";
Lecode.MagicSteps.showWindow = false;


The generator will give this output:


Help text:


*
* @param Gold Gain
* @desc ...
* @default 30
*
* @param Required Steps
* @desc ...
* @default 5
*
* @param Allowed Maps
* @desc ...
* @default [2,5,8]
*
* @param Window Title
* @desc ...
* @default Magic Steps Effects
*
* @param Show Window
* @desc ...
* @default false
*


Code:


Lecode.MagicSteps.goldGain = Number(parameters["Gold Gain"] || 30);
Lecode.MagicSteps.requiredSteps = Number(parameters["Required Steps"] || 5);
Lecode.MagicSteps.allowedMaps = String(parameters["Allowed Maps"] || "[2,5,8]");
Lecode.MagicSteps.windowTitle = String(parameters["Window Title"] || "Magic Steps Effects");
Lecode.MagicSteps.showWindow = String(parameters["Show Window"] || 'false') === 'true';


Isn't it handy ?


But you can also have more control over the descriptions and the param name:


Lecode.MagicSteps.goldGain = 30; // (Gold): Amount of gold obtained.
Lecode.MagicSteps.requiredSteps = 5; // (): Required steps to gain rewards.


Output help text:


*
* @param Gold
* @desc Amount of gold obtained.
* @default 30
*
* @param Required Steps
* @desc Required steps to gain rewards.
* @default 5
*


Thus, you're defining your parameter, it's default value, the description and name at the same place.


No more scrolling up to write in the plugin header.


You can also add a divider.


Lecode.MagicSteps.goldGain = 30; // (Gold): Amount of gold obtained.
Lecode.MagicSteps.requiredSteps = 5; // (): Required steps to gain rewards.
Lecode.MagicSteps.allowedMaps = "[2,5,8]";
// Divider: -- Window --
Lecode.MagicSteps.windowTitle = "Magic Steps Effects";
Lecode.MagicSteps.showWindow = false; // (Show Notification ?):
Lecode.MagicSteps.showIcon = String(parameters["Show Icon"] || 'false') === 'true';


Output help text:


*
* @param Gold
* @desc Amount of gold obtained.
* @default 30
*
* @param Required Steps
* @desc Required steps to gain rewards.
* @default 5
*
* @param Allowed Maps
* @desc ...
* @default [2,5,8]
*
* @param -- Window --
* @desc ...
* @default
*
* @param Window Title
* @desc ...
* @default Magic Steps Effects
*
* @param Show Notification ?
* @desc ...
* @default false
*
* @param Show Icon
* @desc ...
* @default false
*


The tool is available here.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top