1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Detecting if a specific mod ID is active in Lua

Discussion in 'Civ5 - SDK / LUA' started by Vicevirtuoso, Feb 2, 2014.

  1. Vicevirtuoso

    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?
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,358
    Location:
    Near Portsmouth, UK
    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
     
  3. Vicevirtuoso

    Vicevirtuoso The Modetta Man

    Joined:
    May 14, 2013
    Messages:
    775
    Location:
    The Wreckage, Brother
    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.

    Thanks. What would the Civ 5 modding community do without you?
     
  4. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    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).
     
  5. Tomahawk.nsk

    Tomahawk.nsk Chieftain

    Joined:
    Nov 25, 2015
    Messages:
    83
    Location:
    Novosibirsk, Siberia
    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!
     

Share This Page