MZ use the plugin commands of another plugin in own plugin.

Hello everyone,

I want to get into plugin creation and was wondering, if it is possible to use the plugin commands of another plugin in my own plugins? Obviously, my plugin would require that other plugin installed. For example, I really like to use the VZ_GabWindow plugin to show text on screen. Would I be able to call the gab window commands in my own plugin's code?

Regards
Lufos
This could be what you need:

JavaScript:
const args = { ... }; // your Plugin Arguments go here
// Info: all your args need to be strings. Nested objects must be stringified. See my next comment in the Thread

PluginManager.callCommand(window.global, 'VS_GabWindow', 'methodName', args);

I cannot test it right now, so let me know if it works for you.
Thank you, I will give it a try.

/edit: Ok, lets take gabWindow as an example. I guess the correct line would be:

JavaScript:
PluginManager.callCommand(window.global, 'VisuMZ_4_GabWindow', 'GabTextOnly', args);

When picking the Gab Window plugin command "GabTextOnly" the user needs to/can fill in "Text", "ForceGab" and "Optional Settings". How would I call the command and set these arguments at the same time?
Your args must be strings-only; I forgot to mention that in my first post. That means:

When your argument is a boolean (true or false), your value must be 'true' or 'false' with the ' symbols.

When your argument is a number, it must be its string representation.

When your argument is a structure, i.e., a popup dialog, it becomes more challenging. It must be a serialized JSON object. Example:

JavaScript:
const structure = JSON.stringify({ settingA: 'a string', settingB: '1' })

All in all, I come to this:

JavaScript:
const optionalSettings = {
  settingA: 'a string',
  settingB: '1' // remember, numbers are not allowed, must be string instead
}

const args = {
  text: 'Your text',
  forceGab: 'true', //remember, it must be a string, not a boolean
  optionalSettings: JSON.stringify(optionalSettings)
}

PluginManager.callCommand(window.global, 'VisuMZ_4_GabWindow', 'GabTextOnly', args);
thanks again. I came up with this and it also works:

JavaScript:
PluginManager.callCommand(window.global, 'VisuMZ_4_GabWindow', 'GabTextOnly', {Text: "\\LastGainObjQuantityx \\LastGainObj obtained!"});

Original thread: https://forums.rpgmakerweb.com/threads/use-the-plugin-commands-of-another-plugin-in-own-plugin.157402/