Howto use the "plugin command"?

Let's say I have an array of strings in my plugin. And I'd like the user to add another string-item to that array. I suppose I'm supposed to use the plugin command (on the 3rd page) option in the event instead of a script call? And if so, how am I gonna do this (properly!) for 'private' and public variables?

Code:
// MyInsanelyCoolPlugin.jsvar my_public_array = []; // best way to make a user populate this?(function(){  var myArray = [];  function populate(text) // best way to make a user call this?  {    myArray.push(text);  }})();
Plugin commands are given two arguments, the first 'word', and an array of strings. The Plugin Command option lets the user type in one line of text, and it splits it by spaces. The first 'word' in the split string is passed to the pluginCommand function as the 'command' argument. The rest are passed in as an array of strings.

What you have to do is see if the command is for your plugin. Typically, people use their plugin name for this. If it is, then you need to check the array of strings for values you expect, and then do things based on that. If the command is not related to your plugin, you do nothing, as this command is not for you.
How do I intercept this 'event'. How does my plugin know the user called it? Or must I check that somehow every frame (hope not)?

Your explanation still helped me a lot because the helpfile was slightly unclear to me.

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand = function(command, args){ _Game_Interpreter_pluginCommand.call(this, command, args); if (command.toLowerCase() == 'itemlog') { PluginCommand(command, args); }}// args is an array of stringsfunction PluginCommand(cmd, args){ for (var i = 0; i < args.length; i++) { alert(args); }}How do I pass spaces? Like I want to enter this command:

itemlog item1 item2 item3 "this is one single item"The quotes do not work. Single quotes also do not work. I guess I must use underscores and replace them afterwards with spaces.
I have the same question. I wish someone had responded.

Sorry for necroposting. I dont see a way to delete a comment.
@DerekPaxton Members can't delete posts only Mods can.

I suggest you start a new thread with details of your problem and what you have tried so far so that people don't suggest something that you know doesn't work.

Moderator note: I am therefore closing this

Original thread: https://forums.rpgmakerweb.com/threads/howto-use-the-plugin-command.49049/