kiopho Posted November 2, 2013 Share Posted November 2, 2013 (edited) [sOLVED]Well the title says it all : I want to know how to check if a mod is active or not. What would be the condition like ? Edited November 2, 2013 by kiopho Link to comment https://forums.kleientertainment.com/forums/topic/29314-check-if-a-mod-is-activated-through-modmain/ Share on other sites More sharing options...
simplex Posted November 2, 2013 Share Posted November 2, 2013 (edited) Well the title says it all : I want to know how to check if a mod is active or not. What would be the condition like ?You can doif GLOBAL.KnownModIndex:IsModEnabled("somemod") or GLOBAL.KnownModIndex:IsModForceEnabled("somemod") then print "active!"endhowever the "somemod" above is the mod's directory name, so in particular that won't do any good if the mod was installed through the Workshop. I think the best approach is to get the list of all mods which are enabled/force enabled (which is returned as a list of mod directory names), and for each of those check that mod's modinfo for its "human readable name", e.g.for _, moddir in ipairs( GLOBAL.KnownModIndex:GetModsToLoad() ) do if GLOBAL.KnownModIndex:GetModInfo(moddir).name == "somemod" then print "active!" endend Edited November 2, 2013 by simplex Link to comment https://forums.kleientertainment.com/forums/topic/29314-check-if-a-mod-is-activated-through-modmain/#findComment-359795 Share on other sites More sharing options...
kiopho Posted November 2, 2013 Author Share Posted November 2, 2013 You can doif GLOBAL.KnownModIndex:IsModEnabled("somemod") or GLOBAL.KnownModIndex:IsModForceEnabled("somemod") then print "active!"endhowever the "somemod" above is the mod's directory name, so in particular that won't do any good if the mod was installed through the Workshop. I think the best approach is to get the list of all mods which are enabled/force enabled (which is returned as a list of mod directory names), and for each of those check that mod's modinfo for its "human readable name", e.g.for _, moddir in ipairs( GLOBAL.KnownModIndex:GetModsToLoad() ) do if GLOBAL.KnownModIndex:GetModInfo(moddir).name == "somemod" then print "active!" endend Thanks for the quick response buddy, I'll give it a try. Link to comment https://forums.kleientertainment.com/forums/topic/29314-check-if-a-mod-is-activated-through-modmain/#findComment-359805 Share on other sites More sharing options...
kiopho Posted November 2, 2013 Author Share Posted November 2, 2013 @simplex Works like a charm ! Thanks again man. Link to comment https://forums.kleientertainment.com/forums/topic/29314-check-if-a-mod-is-activated-through-modmain/#findComment-359821 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now