I actually support the idea of using
/** * Multiplies two numbers * @param x Description of x * @param y Description of y * @return the multiplication between x and y */function mul(x, y) { return x * y;};This type of parameters, but for a good reason:
This is the format than programs like doxygen and other manual generators works.
This is good, because you can pass your folder of plugins to programs like that and creates a good html manual for you ready to use.
This may be "harder" to read to some non scripters, but having html documentation is a blessing sometimes.
My edit was targeted at Ramiro's comment. My addition is to make the code more readable by dividing it into segments. These comments aren't recognized by a doc parser and thus won't hurt.
Json is the preferred way to go its how most applications that have plugins written in javascript deal with configuration options. even if its not valid json you can still make objects for configuration.
yes I will have sadly to learn the structure of JSON structure I will ask to Galenmereth how it's works because he is the one who know the thing's who will suit better my AI_Core
I see this not a bad idea!
Game_AI.prototype.interaction = function(interaction_type) { switch (interaction_type) { case 'normal' : this.dialogue_system.add("text"); this.change_expression(1); break; }};Game_AI.prototype.curtain_interactions = function(curtain_type) { switch(curtain_type){ case "entering" : this.entering_interaction(); break; case "quitting" : this.quitting_interaction(); }};Game_AI.prototype.entering_interaction = function() { this.call_effect("inhori_slide",2,100); this.change_expression(1); this.dialogue_system.add(this.greeting);};Game_AI.prototype.quitting_interaction = function() { this.change_expression(2); this.dialogue_system.add(this.byebye); this.call_effect("outhori_slide",2,100);};but the problem I got explained from JSON is the fact it's can slow the process
and people will need to edit this part for add more "option" to the AI
or simply edit how the AI will react ect
I know the thing's of prototype it's not please you but I just follow how MV works
also the thing's I don't want my code
"Immutability"
Since it's a base who people can freely edit as their need
if you want to separate areas in doxygen you could use groups to (just for the sake of it)
/** * @group Thing's attributes *//** @{ */ /* Put your content here *//** @} */ /* End of thing's attributes */Javadoc and doxygen are not really too different now, if you are working with java you should follow javadoc, because it's the most people agree with, and it's official.
ECMA still don't include anything to documment oficially, but Doxygen is an old one (and used widely) and most docummentation tools are more or less the same.
you can mix of course the style of
//====================================================// **Section//====================================================or use both:
//====================================================/** @group Thing's attributes *///====================================================/** @{ *//* Put your content here *//** @} */ /* End of thing's attributes */I won't view it badly while if I can check an html document with that info, because usually I don't review other scripter's code, but just the API parts...
That looks really bad I suggest staying the way the community as a whole suggests doing docs
Hi there,
as i have seen in a plugin the comments should look like this:
//=============================================================================// Plugin Configuration Section// !!!This is used by RPG-Maker MV and MUST stay intact!!!//=============================================================================/*: * @plugindesc A simple Plugin-Template * @author Churanos * * @param Enable Console * @desc Enables a console window on startup * @default true *///=============================================================================Note the block comment, this is the way RMMV finds the options for the given plugin.
This example is shortend, a bigger example can be found in Yanfly's plugin.
I think all other comments are up to the developer and should strip of in production.
I think that the Module Pattern for plugins is best suited. I use mostly Typescript to avoid mistakes and to write clean code.
There are some supersets to JavaScript, I think you can speak so most developers.
A simple example in TypeScript:
module CPM { export class Console { static Params = PluginManager.parameters('Plugin-Template'); static EnableConsole = Boolean(Console.Params['Enable Console']); static openConsole(): void { if (Console.EnableConsole || isDebugEnabled()) { if (Utils.isNWjs()) { var _debugWindow = require('nw.gui').Window.get().showDevTools(); } } } } export function isDebugEnabled(): boolean { return location.search.slice(1).split("&").indexOf("debug") >= 0; } Console.openConsole();}in JavaScript it looks like this:
var CPM;(function (CPM) { var Console = (function () { function Console() { } Console.openConsole = function () { if (Console.EnableConsole || isDebugEnabled()) { if (Utils.isNWjs()) { var _debugWindow = require('nw.gui').Window.get().showDevTools(); } } }; Console.Params = PluginManager.parameters('Plugin-Template'); Console.EnableConsole = Boolean(Console.Params['Enable Console']); return Console; })(); CPM.Console = Console; function isDebugEnabled() { return location.search.slice(1).split("&").indexOf("debug") >= 0; } CPM.isDebugEnabled = isDebugEnabled; Console.openConsole();})(CPM || (CPM = {}));The result is works the same way like using the prototype or using static functions.
I dont like using the prototype, too. This way i can use my favorite coding tools and the result is just the same.
GZ Churanos.