kiopho Posted November 2, 2013 Share Posted November 2, 2013 [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 ? Link to comment Share on other sites More sharing options...
simplex Posted November 2, 2013 Share Posted November 2, 2013 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 Link to comment 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 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 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.