Hard Fail at plugins...

I've tried loads of different ways round, currently I have this...

function DeStatus() {
this.initialize.apply(this, arguments);
}

(function() {
var _DeStatus_test = DeStatus.prototype.test;
DeStatus.prototype.test = function() {
console.log("Here we are...");
_DeStatus_test.call(this);
};
})();

I've tried to call it from an event like this
$DeStatus.test()
DeStatus.test()

I've tried all sorts of different things but just looking at the plugins isn't a substitute for documentation!

another issue I have, while I can make and display a choices menu, how do you wait for and get the response?

I've moved this thread to Learning Javascript. Thank you.

I already know how to code in JavaScript, I thought this forum was for people who didn't know JavaScript...
That forum was for a script you are making. There is no script or plug-in in the post, just code. Hence why it goes here instead.
I already know how to code in JavaScript, I thought this forum was for people who didn't know JavaScript...
I have to correct you, you learned the basics of javascript.
What you are trying to do is object oriented programming, but you clearly have no idea how it works. I don't mean to mock you though, everyone begins in the same place and I made the same mistakes when I begun.

First of all, you have mashed up a couple of things together without knowing what it is about.

Code:
function DeStatus() {
this.initialize.apply(this, arguments);
}

(function() {
var _DeStatus_test = DeStatus.prototype.test;
DeStatus.prototype.test = function() {
console.log("Here we are...");
_DeStatus_test.call(this);
};
})();

The first one is useful only when you have an object you can point it to (for example when DeStatus is a child object of Scene_Menu, it will gain all arguments Scene_Menu has. Since it's not a child of anything, it doesn't receive any arguments and initialize.apply is therefore completely pointless.

Next you used an anonymous function.
(function () {
code}
is an anonymous function that will automatically call itself. There's no need to trigger it.

Next you said you tried to call the function through
$DeStatus.test()
DeStatus.test()

But neither of these is bound to work.

$gameParty, $gameVariables, etc. work only because they have been explicitely defined. To be concrete they have been constructed in rpg_managers. In fact you can find this function
Code:
DataManager.createGameObjects = function() {
    $gameTemp          = new Game_Temp();
    $gameSystem        = new Game_System();
    $gameScreen        = new Game_Screen();
    $gameTimer         = new Game_Timer();
    $gameMessage       = new Game_Message();
    $gameSwitches      = new Game_Switches();
    $gameVariables     = new Game_Variables();
    $gameSelfSwitches  = new Game_SelfSwitches();
    $gameActors        = new Game_Actors();
    $gameParty         = new Game_Party();
    $gameTroop         = new Game_Troop();
    $gameMap           = new Game_Map();
    $gamePlayer        = new Game_Player();
};
and the word new is very important, because that means they are not aliasing, but they are constructed.
And the fact that they are constructed is very important, because it gives them access to prototype functions without the need to use the word "prototype".

So unless you define a constructor for your function and then construct $deStatus,it will simply not work.
And DeStatus.test () will not work, because test is not a method of DeStatus, but its' prototype function, so to call it you have to use DeStatus.prototype.test () to call this function.

I suggest you go study some object oriented programming before you begin making your own plugins.
still doesn't help me call a plugin function from an event...
That is because you defined it inside an anonymous function.
doesn't help that plugin command isn't javascript, anyhow got plugin commands working fine now and at least I see why aliasing is needed...
We aren't talking about plugin commands, but script calls. Plugin commands work completely differently.
it wasn't clear to me that plugin command wasn't anything other than a script call....
Yeah, plugin commands are script calls, but very specific ones, in a specific format that I don't really know, since I don't make plugins for public 😀
basically replace brackets and commas with spaces... why.... ? less scary ???
No, because 1. plugin commands are regular expressions and 2. it is more user friendly for those that don't know javascript. There are many people that don't want/don't have time to learn even basics.
foo(1,5)

vs

foo 1 5

I don't see much difference, where can I read about how regular expressions are used in plugin commands
By studying plugins made by other people, that's the best advice.

You're right, foo (1,5) vs. foo 1,5 doesn't make much of a difference.
However
cameraZoom 1, 120
$gameMap.cameraZoom (1, 120)

That was not the best example, but what about this?

hud actor 1 hp
vs.
$gameMap.buildHUD ($gameActors.actor(1)._hp)

I can't imagine I would tell total beginners to use my plugins with these scripts when regExp can simplify it a great deal.

Original thread: https://forums.rpgmakerweb.com/threads/hard-fail-at-plugins.86976/