Is it possible to check if a certain Plugin in the "Plugin List" is Turned on or off?

Just asking out of curiousity.
Is there a Scriptline to check if a certain Plugin in the "Plugin List" is Turned on or off?

For a Tutorial Idea i wanted to Show regular title Screen.
Than on the first Game Map i wanted to check if the Plugin is on or off (In this Case Skip Title Screen Plugin).
If its on, than the self Made Title Screen appears.
If its Off, a NPC shows up and explains to close the Project and turn on the Plugin and than the self made Title Screen appears. Just an vague Idea.

Edit:
Turning On or Off installed Plugins from inside the Game, is that possible?
And would those changes be only for that playthrough safefile or would it be changed globaly/permanently for that Project?
The plugin settings are loaded through the "js/plugins.js" file, you can see how the structure is set up there. For example, you can use
$plugins[0].status
in your project to check if the first plugin in the list is enabled (true) or disabled (false). The plugins themselves are loaded accordingly through the PluginManager at the beginning of "main.js".

While you can search the $plugins array for an entry with a specific name and check if it exists and is enabled, I would argue that in praxis it is easier to just have your title screen skip plugin report in some way that the title screen was skipped, for example by activating a switch, at least most of the time.


Turning On or Off installed Plugins from inside the Game, is that possible?
I'm not sure if it is easily possible in general, but it is probably not a good idea to do that in the first place.

Plugins are generally loaded before even entering the title screen. They modify what happens at specific points in your game and may rely on these modifications being consistent.

For example, a "Quest Log" plugin may rely on creating a quest log object when the player hits "New Game". If you load the plugin later and the plugin wasn't present when the player did that, the quest log object might not exist and the game might crash when subsequently trying to add a quest.

Other plugins may rely on a certain insertion order and will break if loaded out of order.

Generally it becomes a lot harder to debug if you cannot be sure which function definitions were active at any given time.


Usually, when you are trying to enable/disable a plugin during the game, the best idea is to write the plugin so it supports this in its own way. For example, that fabled "Quest Log" plugin might be written to create all its objects regardless of whether it is enabled, even allow the game to add quests, but hide the "Questlog" menu option when a certain switch is on to make itself invisible to the player.

Unfortunately, I don't think there is a one-size-fits-all option for this.
Supposing I wanted to determine whether or not YEP_ItemCore is enabled, I could use this script:
JavaScript:
$plugins.find(plugin => plugin.name == "YEP_ItemCore")?.status

It will return true if the plugin is enabled, and falsey if it's not. You could stick it right into the script box of a Conditional Branch event command, if you want.

Technically, turning on a plugin in-game is easy enough. But for the reasons that @Another Fen mentioned, whether or not doing so will cause problems is very situational. Turning a plugin off would be difficult, since you can't just un-load code that is already loaded. It's not impossible, but it's not something that has a universal solution.
Yup, @Arthran, your it's okay. But you have a typo, should be
Code:
$plugins.find(plugin => plugin.name == "YEP_ItemCore").status

This one @Bex displays all enabled plugins:
Code:
$plugins.filter(plugin => plugin.status == true)

and disabled plugins:
Code:
$plugins.filter(plugin => plugin.status == false)
Yup, @Arthran, your code checks just one plugin and it's okay. But you have a typo, should be
Code:
$plugins.find(plugin => plugin.name == "YEP_ItemCore").status
It actually wasn't a typo. The ?. is called an optional chaining operator. What it does is prevents an error when you try to access a property of a nullish object.

If you use:
JavaScript:
$plugins.find(plugin => plugin.name == "YEP_ItemCore").status

Then it will crash the game if YEP_ItemCore is not in the plugin list. The .find method would return undefined, and you cannot access undefined.status.

However, if you use:
JavaScript:
$plugins.find(plugin => plugin.name == "YEP_ItemCore")?.status

Then it will *not* crash the game if YEP_ItemCore is not in the plugin list. Instead of triggering the error, it will return a falsey value instead. When used in a conditional statement, it's kind of (but not exactly) like a shorthand equivalent of:
JavaScript:
($plugins.find(plugin => plugin.name == "YEP_ItemCore") && $plugins.find(plugin => plugin.name == "YEP_ItemCore").status)

I would assume that the OP knows which plugins are in his plugin list, and which aren't, so it's probably not necessary. But since you can get an extra layer of protection just by typing one more character, then I figured that there's no good reason not to.
But you have a typo,
Actually, Arthran's code is correct. That extra question mark avoids an error message if the plugin is not found (and returns undefined in that case). It shouldn't matter in most cases, as you wouldn't be searching for a plugin that you don't have, but it's more correct.
Thank you very much to ALL of you. The condition is help enough. Thanks for answering this.
Actually, Arthran's code is correct. That extra question mark avoids an error message if the plugin is not found (and returns undefined in that case). It shouldn't matter in most cases, as you wouldn't be searching for a plugin that you don't have, but it's more correct.
Ahh, that's right - my nwjs throws error, but I'm using the old one 0.29.x - in later releases it's fixed.
Ahh, that's right - my nwjs throws error, but I'm using the old one 0.29.x - in later releases it's fixed.
Oops. Sometimes I forget that not everyone uses the same version of NW.js that I do.
Just curious, which version you are using? Because I struggle with recent releases with WEBGL_CONTEXT_LOST problem and I'm looking for good and updated version of NWJS
I use 0.48.4, since I primarily use MZ and that's the version that comes with it. I have also updated MV to 0.48.4, and it seems to work fine.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-check-if-a-certain-plugin-in-the-plugin-list-is-turned-on-or-off.150217/