Is there a way to check if a plugin is present?

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
Hi guys!

As in the title, is there a way to check if a plugin is present?
I want to create a condition for an event to act one way if the "a.js" plugin is present and to act otherwise if the "a.js" plugin is NOT present.

Does anyone know how to do this?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,163
Reaction score
12,438
First Language
English
Primarily Uses
RMMV
Is it a particular plugin?

Some plugin creators (like Yanfly) add code that tracks what plugins you have, and what versions they're at. Yanfly's in particular will sometimes check to see what OTHER Yanfly plugins are present, and what versions the are.

If it's a plugin like that, you could do a similar check via script call in a conditional branch.
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
511
Reaction score
198
First Language
thai
Primarily Uses
RMMV
how do you use that?
your game had an updater for plugin?
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
how do you use that?
your game had an updater for plugin?
I'm creating a system that is a combination of events and plugins and i'll release this soon.
The big problem is that some plugins are paid.
Because of this, i want to create different behaviors if the user has the paid plugin or not, since I will not be able to release this freely available along with my system.
If the user has the paid plugin, my system will prefer the paid behavior, if not, this will play the "non-plugin" behavior, you got it?


Is it a particular plugin?

Some plugin creators (like Yanfly) add code that tracks what plugins you have, and what versions they're at. Yanfly's in particular will sometimes check to see what OTHER Yanfly plugins are present, and what versions the are.

If it's a plugin like that, you could do a similar check via script call in a conditional branch.
Can you teach me how i do that check?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,163
Reaction score
12,438
First Language
English
Primarily Uses
RMMV
What is the plugin?
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
511
Reaction score
198
First Language
thai
Primarily Uses
RMMV
I'm creating a system that is a combination of events and plugins and i'll release this soon.
The big problem is that some plugins are paid.
Because of this, i want to create different behaviors if the user has the paid plugin or not, since I will not be able to release this freely available along with my system.
If the user has the paid plugin, my system will prefer the paid behavior, if not, this will play the "non-plugin" behavior, you got it?
Doesn't your license of paid plugin allow you to commercial the game with the plugin?
it's weird if it can't...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,163
Reaction score
12,438
First Language
English
Primarily Uses
RMMV
Oh, I wish I'd read your comment more fully.

Pasunna is right - YOU have to pay for the plugin, not the person playing your game. If YOU have paid for the plugin and are including it with your game, you are distributing it to everyone who downloads your game, whether they have paid for the plugin or not (and most people wouldn't have bought it). You might be able to make your game pretend the plugin isn't there, but it is.

Any check I gave you would simply say whether YOU had included the plugin in the game or not. There is no way it could check on your player's computer to see if THEY have the plugin saved or installed anywhere.
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
Oh, I wish I'd read your comment more fully.

Pasunna is right - YOU have to pay for the plugin, not the person playing your game. If YOU have paid for the plugin and are including it with your game, you are distributing it to everyone who downloads your game, whether they have paid for the plugin or not (and most people wouldn't have bought it). You might be able to make your game pretend the plugin isn't there, but it is.

Any check I gave you would simply say whether YOU had included the plugin in the game or not. There is no way it could check on your player's computer to see if THEY have the plugin saved or installed anywhere.
You two are right. But i'm not developing a game, but a system for other developers to use.
Are there problems with making these plugins available?
Anyway, my system will be paid and is almost the same as selling a game, but this will be an open project and will not be deployed and encrypted.
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
511
Reaction score
198
First Language
thai
Primarily Uses
RMMV
I'm not specialized on this
but maybe you discus it with the other author of plugin is better
maybe make a profit shared deal
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,163
Reaction score
12,438
First Language
English
Primarily Uses
RMMV
I think you are saying that you are making a project that contains your system, and you want to include Yanfly's plugin in that project - is that right? No, you can't do that - it'd be like buying Yanfly's plugin, then just giving it to everyone. Whether you are giving your system away or selling it makes no difference.

So yes, going back to your original idea, you could make YOUR system check to see if the plugin exists, and behave one way or the other depending on the results, but you would make sure when distributing your system that no paid plugins are included. Then if the person using your system has the plugin, they can add it to the project, but you are not giving it to them. You'll have to be really careful though, because all it takes is for you to make an update to your system to send out to everyone, and forget to remove the paid plugins, and you will have breached the T&C of all of your paid plugins (and other paid resources).

If you want to do that, then you can put this in either your code/plugin, or in the Script part of the conditional branch, and it will evaluate to true if the YEP_PluginCmdSwVar.js is present and enabled, and false if it's not:

Code:
$plugins.filter(function(p) { return p.description.name === 'YEP_PluginCmdSwVar' && p.status === true; }).length > 0
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,080
Reaction score
7,050
First Language
German
Primarily Uses
RMMV
Are there problems with making these plugins available?
Anyway, my system will be paid and is almost the same as selling a game, but this will be an open project and will not be deployed and encrypted.
Depends.
The problem here is that you are re-distributing the plugins if you do that, and that is legally different from using plugins in your own game.
A lot of the plugin writers give free licence to use their plugins in games (even in commercial games), but most of them specifically forbid re-distributing or re-uploading them.

That has nothing to do with your idea, it is mostly because having a plugin available in different places makes updating it more difficult, and creates even more problems with support (which version does that user has?).
And getting references and be known by their own website is in a lot of cases the only reward those programmers get for their work when giving it away for free, so they don't like if someone else gets the attention for redistributing their work.

So basically you would have to ask each writer of each plugin included in your system for a specific licence before you could use it - which will be a problem in cases like Yanfly because Yanfly (and several other plugin writer) have already left the community. (the payments for yanfly's plugins do not go to yanfly, that was set up as a way to pay for future compatibility updates to those plugins)

EDIT:
If you follow @Shaz advise above not only for paid plugins but also for those free plugins where you didn't get licence for redistributing, then you'll be on the safe side - but you would have to tell your customers where to get those other plugins and hope that those other websites will still be available in a few years.
Because otherwise your product will become unavailable if the website with the other plugins suddenly goes down...
 
Last edited:

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
I think you are saying that you are making a project that contains your system, and you want to include Yanfly's plugin in that project - is that right? No, you can't do that - it'd be like buying Yanfly's plugin, then just giving it to everyone. Whether you are giving your system away or selling it makes no difference.

So yes, going back to your original idea, you could make YOUR system check to see if the plugin exists, and behave one way or the other depending on the results, but you would make sure when distributing your system that no paid plugins are included. Then if the person using your system has the plugin, they can add it to the project, but you are not giving it to them. You'll have to be really careful though, because all it takes is for you to make an update to your system to send out to everyone, and forget to remove the paid plugins, and you will have breached the T&C of all of your paid plugins (and other paid resources).

If you want to do that, then you can put this in either your code/plugin, or in the Script part of the conditional branch, and it will evaluate to true if the YEP_PluginCmdSwVar.js is present and enabled, and false if it's not:

Code:
$plugins.filter(function(p) { return p.description.name === 'YEP_PluginCmdSwVar' && p.status === true; }).length > 0
Just putting this in a script condition will it work?
Thank you so much, this is what i'am looking for!

Edit: The condition doesn't worked, but that's the idea.
Event.png

Does Not Worked.png


Depends.
The problem here is that you are re-distributing the plugins if you do that, and that is legally different from using plugins in your own game.
A lot of the plugin writers give free licence to use their plugins in games (even in commercial games), but most of them specifically forbid re-distributing or re-uploading them.

That has nothing to do with your idea, it is mostly because having a plugin available in different places makes updating it more difficult, and creates even more problems with support (which version does that user has?).
And getting references and be known by their own website is in a lot of cases the only reward those programmers get for their work when giving it away for free, so they don't like if someone else gets the attention for redistributing their work.

So basically you would have to ask each writer of each plugin included in your system for a specific licence before you could use it - which will be a problem in cases like Yanfly because Yanfly (and several other plugin writer) have already left the community. (the payments for yanfly's plugins do not go to yanfly, that was set up as a way to pay for future compatibility updates to those plugins)

EDIT:
If you follow @Shaz advise above not only for paid plugins but also for those free plugins where you didn't get licence for redistributing, then you'll be on the safe side - but you would have to tell your customers where to get those other plugins and hope that those other websites will still be available in a few years.
Because otherwise your product will become unavailable if the website with the other plugins suddenly goes down...
I think exactly that way, which is why I want to create a different behavior in the project in case the user has the plugin or not.
If the user purchases the plugin directly from the creator and wants to add it manually, he will have extra functionality, otherwise he will not have it.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,163
Reaction score
12,438
First Language
English
Primarily Uses
RMMV
Just putting this in a script condition will it work?
Yes. If you are making an event, do Conditional Branch > Script > and then the code I gave you.

If you are making a plugin, then you'd do
Code:
if (the code I gave you) { do stuff }
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
Yes. If you are making an event, do Conditional Branch > Script > and then the code I gave you.

If you are making a plugin, then you'd do
Code:
if (the code I gave you) { do stuff }
I made it right now, it doesn't worked. :-(
 
Last edited:

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
120
First Language
English
Primarily Uses
RMMV
Can't you just do
Code:
Imported.YEP_PluginCmdSwVar
At the top of all Yanfly plugins and usually other people they do
Code:
var Imported = Imported || {};
Imported.YEP_PluginCmdSwVar = true;
If it isn't imported it would be undefined so false;
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
Can't you just do
Code:
Imported.YEP_PluginCmdSwVar
At the top of all Yanfly plugins and usually other people they do
Code:
var Imported = Imported || {};
Imported.YEP_PluginCmdSwVar = true;
If it isn't imported it would be undefined so false;
I put only the "Imported.YEP_PluginCmdSwVar = true;" in a conditional branch and
IT WORKED! Thank you so much, man!
You always help me! :cutesmile:

The mods can close the topic, as this was solved.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,163
Reaction score
12,438
First Language
English
Primarily Uses
RMMV
It won't work for all plugins. This is what I mentioned right at the start - being able to do that requires that the plugin creator added that Imported.<stuff> to their plugin, and many don't.

I had an error in the command I gave you - if you use this instead (of what I gave you before), it should work. And if it works, it will work for all plugins, even if the author didn't add that stuff:

Code:
$plugins.filter(function(p) { return p.name === 'YEP_PluginCmdSwVar' && p.status === true; }).length > 0
It does, however, require that the user saved the plugin with the correct file name, and they don't always do that.


To have your thread closed, you should report the first post and let the mods know your question is answered. Don't rely on them reading your comment.
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
126
Reaction score
84
First Language
Portuguese
Primarily Uses
RMMV
It won't work for all plugins. This is what I mentioned right at the start - being able to do that requires that the plugin creator added that Imported.<stuff> to their plugin, and many don't.

I had an error in the command I gave you - if you use this instead (of what I gave you before), it should work. And if it works, it will work for all plugins, even if the author didn't add that stuff:

Code:
$plugins.filter(function(p) { return p.name === 'YEP_PluginCmdSwVar' && p.status === true; }).length > 0
It does, however, require that the user saved the plugin with the correct file name, and they don't always do that.


To have your thread closed, you should report the first post and let the mods know your question is answered. Don't rely on them reading your comment.
Got it!
The imported variable worked with the Yanfly's plugin.
But i tested with another plugin and your code worked, while the imported don't, as it don't have imported variable in its code.

Thanks for all the help, my friend!
Now the doubt has been completely clarified. :thumbsup-right:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Finally figured out how to make a signature with a pic that leads to a link, it's so cool! Click the image to check out my demo! :kaopride:
When you are very focus making a game on a Monday morning and doing your very best to make it perfect for your players. Than smile to take a break and realize it is Friday... o_o
Are there any vocalists on RPG Maker Forums that would want to sing together in a group, duet or make a whole channel together?
Here it is in all its leggy glory! I apologize in advance.

Forum statistics

Threads
98,180
Messages
950,146
Members
129,483
Latest member
g_loyola
Top