I have a couple of addons that work with tracking needed traits & recipes. I was "hoping" to find a way for them to share that information (and with other addons) so they don't all have to do the same work.
I thought about writing a library, which works, but I can not get saved variables to work with it. I figured libraries probably weren't really supposed to be saving things, but was hoping to find a way around it. I managed to get it to save the information, by doing:
Lua Code:
local MAJOR, MINOR = "LibNeed4Research-1.0", 3
local ln4r, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not ln4r then return end
local function OnAddOnLoaded(_event, _sAddonName)
if _sAddonName == "ZO_Ingame" then
ln4r:Initialize()
end
ln4r.asv = ZO_SavedVars:NewAccountWide("LibNeed4ResearchVars", 1, nil, varDefaults)
ACV = ln4r.asv
EVENT_MANAGER:UnregisterForEvent("LibNeed4Research", EVENT_ADD_ON_LOADED)
end
EVENT_MANAGER:RegisterForEvent("LibNeed4Research", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
It creates a saved variable file & writes to it, but it seems like it won't reload it. It seems like it is reinitializing the varDefaults variables every time. I'm guessing its just not possible?
I tried to look at the zo_savedvars.lua to figure out how it is loaded to see what is wrong, but I didn't quite understand it all.
So before I give up on it and scrap the whole thing I figured I'de give it a shot and ask.
Is this possible to do somehow without installing it as a stand alone addon? I just don't know if people would want to bother with installing some separate addon that does nothing but track data.