BG3-Community-Library-Team / BG3-Compatibility-Framework

An API-based Driven Compatibility Framework for Baldur's Gate 3 Mods
MIT License
38 stars 13 forks source link

Trying to activate debug mod #99

Closed arnaudpourbaix closed 5 months ago

arnaudpourbaix commented 5 months ago

In my bootstrap module, I have put this code:

if Ext.Mod.IsModLoaded("67fbbd53-7c7d-4cfa-9409-6d737b4d92a9") then
    Ext.Utils.Print("CompatibilityFramework ToggleDebug")
    Mods.SubclassCompatibilityFramework.Api.ToggleDebug(true)
end

In SE Console, I have this error:

CompatibilityFramework ToggleDebug
bg3se::lua::State::LoadScript(): Failed to execute script: [string "RAWaddon/BootstrapModule.lua"]:25: attempt to index a nil value (field 'SubclassCompatibilityFramework')
stack traceback:
        RAWaddon/BootstrapModule.lua:25: in main chunk
        [C++ Code]: in field 'Include'
        builtin://BuiltinLibrary.lua:98: in function <builtin://BuiltinLibrary.lua:70>

Did I miss something ? Will it activate before CompatibilityFrameworkConfig.json is parsed ? I suppose because I have an error later on when parsing json, and I need debug to find which UUID is concerned (my file is big).

arnaudpourbaix commented 5 months ago

In BootstrapClient.lua:

if Ext.Mod.IsModLoaded("67fbbd53-7c7d-4cfa-9409-6d737b4d92a9") then
    local function OnStatsLoaded()
        Mods.SubclassCompatibilityFramework.Api.ToggleDebug(true)
    end
    Ext.Events.StatsLoaded:Subscribe(OnStatsLoaded)
end