• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Detecting if a specific mod ID is active in Lua

Vicevirtuoso

The Modetta Man
Joined
May 14, 2013
Messages
775
Location
The Wreckage, Brother
So, I know about and use this line to detect if Brave New World is running:

Code:
ContentManager.IsActive("6DA07636-4123-4018-B643-6575B4EC336B"

Is there anything similar to detect if another mod's ID is active?
 
Assuming

Code:
local IGEModId = "170c8ed1-b516-4fe2-b571-befeac39d220"
local isUsingIGE = ContentManager.IsActive(IGEModId, ContentType.GAMEPLAY)

doesn't work (I've never actually tried using it on mod guids)

Code:
local IGEModId = "170c8ed1-b516-4fe2-b571-befeac39d220"
local isUsingIGE = false

for _, mod in pairs(Modding.GetActivatedMods()) do
  if (mod.ID == IGEModId) then
    isUsingIGE = true
    break
  end
end

does
 
Assuming

Code:
local IGEModId = "170c8ed1-b516-4fe2-b571-befeac39d220"
local isUsingIGE = ContentManager.IsActive(IGEModId, ContentType.GAMEPLAY)

doesn't work (I've never actually tried using it on mod guids)

Yeah, that doesn't work. I think ContentManager is used only for DLC; it works whenever I put in the ID for another DLC, but never for a mod.

Code:
local IGEModId = "170c8ed1-b516-4fe2-b571-befeac39d220"
local isUsingIGE = false

for _, mod in pairs(Modding.GetActivatedMods()) do
  if (mod.ID == IGEModId) then
    isUsingIGE = true
    break
  end
end

does

Thanks. What would the Civ 5 modding community do without you?
 
I have this in my mod code:
Code:
print("")
print("****************************************************************")
print("Installed mods:")
local unsortedInstalledMods = Modding.GetInstalledMods()
for key, modInfo in pairs(unsortedInstalledMods) do
	if modInfo.Enabled then
		print("*ENABLED: " .. modInfo.Name .. " (v " .. modInfo.Version .. ") " .. modInfo.ID)
	else
		print("Disabled: " .. modInfo.Name .. " (v " .. modInfo.Version .. ") " .. modInfo.ID)	
	end
end
print("****************************************************************")
print("")
That way, when I'm troubleshooting a player's Lua.log, I don't have to ask if they have any other mods installed, or what version they are playing (or believe what they tell me).
 
I created a lua file with this code "EnabledModesInfo.lua".

...then added in Community Patch (v 72).modinfo:
<File md5="9DEF7E27A2190D504649BD175BDA9A63" import="0">LUA/EnabledModesInfo.lua</File>

<EntryPoint type="InGameUIAddin" file="EnabledModesInfo.lua">
<Name>EnabledModesInfo.lua</Name>
<Description>EnabledModesInfo.lua</Description>
</EntryPoint>

Thanks!
 
Back
Top Bottom