ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Addon compatibility with other addons (https://www.esoui.com/forums/showthread.php?t=10537)

sinnereso 05/04/23 11:49 AM

Addon compatibility with other addons
 
Hey guys,

Im beginning to look into compatibility for my addon with other major popular ones and could use some pointers.

Fort example i've found an issue with my auto banking and Dolgubon';s lazy writ creator with banking functions. His pulls items out for writs 1st and then mine is throwing them right back in after.

Generally speaking Id like to deal with that on my end but in my head it seems highly complex detecting what his addon is doing from mine and MUCH easier for his addon to temporarily disable my feature and then re-enable it after maybe using one of my global functions?

I literally have a function that could be called to disable mine similar to "function MyFunction(false)" and then true to re-enable it after.

How would another addon call my function and is that even possible? I suspect it is as I've seen something like this for TTC pricing.

Should I approsch Dolgubon and request an addition like:

Code:

If MyAddon ~= nil and MyAddon.savedVariables.autoBank == true then
    MyAddon(function MyFunction(false))-- or something similar
    MyAddon.disabled = true
end

and then when hes done
if MyAddon.disabled == true then
    MyAddon(function MyFunction(true))-- or something similar
    MyAddon.disabled = nil
end

Im not yet the big fish here so I'm not sure if this request would be out of line or something. Sharlikran got all pissy with me for requesting some TTC pricing feature be added to Inventory insight for example. I never understood why and then 2 weeks later I discovered MM was also his addon and it all made sense =p

OR....

Is there a fairly easy way to determine what another addon is actively doing so I can manage my own features accordingly? Actually even a way to detect if the bank was opened by the player or another addon would do the job maybe. I could reuse this for any of my functions that have conflicts but I think my auto banking is going to be the primary issue when other addons take stuff out before my code is run.

Navarill 05/04/23 12:13 PM

Quote:

Originally Posted by sinnereso (Post 47736)
Hey guys,

Im beginning to look into compatibility for my addon with other major popular ones and could use some pointers.

Fort example i've found an issue with my auto banking and Dolgubon';s lazy writ creator with banking functions. His pulls items out for writs 1st and then mine is throwing them right back in after.

Take a look at how Leo's Trainer handled the same issue.

sinnereso 05/04/23 12:16 PM

oh kewl ty. on it.

WOW that was easy.. crude but easy to detect if other addons are running and may do the job.

I could bypass by banking code if other known banking addons are running super easy which I might do temporarily and display a chat msg to that effect when it happens as a quick fix while I learn how this works more.

sinnereso 05/04/23 12:59 PM

Yeh this is working perfectly at least for now.. Ill add every popular banking addon I cant find to this for the moment until I learn how to refine it better. It just disables mine if others are present which is ok as mine is very basic more for new players or those wanting super light weight and aren't eso+. Virtually any other banking addon is more advanced. This is perfect right at the top of my banking function. ty for the tip.

Code:

if PersonalAssistant or WritCreater then--DISABLE BANKING IF OTHER BANKING ADDONS LOADED
        MyAddon.AutoBankToggle(false)
        MyAddon.AutoTelvarToggle(false)
        df(MyAddon.logo .. " Addon Conflict: Auto Bank & Telvar |cCC0000DISABLED|r")
        return
end

Ideally id like to re-enable mine if its just writcreator opening bank after hes done banking maybe with a delay but well see what I come up with.

**EDIT**
Actually ive for the moment decided against disabling mine if any other bank addon enabled as it wouldn't make sense to have multiple running when mine can be easily disabled from settings. I'll leave that to the player to decide which they want to use. im going with temporary disabling while lazy writ creator is running accessing bank for the moment since Id like to use his addon myself :)

Baertram 05/05/23 12:07 AM

You can also read the other addons saved variables to check if this auto pull from back feature is enabled at all as the SV table is always global. But do not change that! Only read please!

Just blocking your feature is the other songaddon is loaded, but the feature at the addon is Off, it's not needed imo.

Check the txt file of the other addon what is the name of the SV file and check in the addon code how it was setup, acvounwide or per character, per server or not etc. Check if the addon provides global functions to read settings so you do not have to build the read code yourself. Else you need to manually check what the actual SV looks like and then read the setting in question from the appropriatevsubtable of the global SV table.

sinnereso 05/05/23 11:48 AM

TY this helps alot actually. Lazy Crafter has a built in function for it but I may need to do this for PA for finer control of specific functions. Or I might just do it this way as a standard because I have so many functions, Im anticipating conficts and NOW is the time to iron them out :). At least for the BIG HIGHLY POPULAR addons. Im looking at them now and will not change theyre settings no worries. Just need to know what they are so I can control my addon accordingly. My hopes is to achieve perfection without them needing any modifications.

I did have a question though regarding lazy writ crafter for example. Ive found his saved vars and appears to have 2.

Code:

(1)WritCreater.savedVarsAccountWide = ZO_SavedVars:NewAccountWide(
                "DolgubonsWritCrafterSavedVars", WritCreater.versionAccount, nil, WritCreater.defaultAccountWide)

and

Code:

(2)WritCreater.savedVars = ZO_SavedVars:NewCharacterIdSettings(
                "DolgubonsWritCrafterSavedVars", WritCreater.version, nil, WritCreater.savedVarsAccountWide.accountWideProfile)


for a specific setting(shouldGrab) should I account for both? like this below? and I still dont understand why my account wide settings in it are saved in (2).

Code:

if WritCreater.savedVars.shouldGrab or WritCreater.savedVarsAccountWide.shouldGrab then


All times are GMT -6. The time now is 09:49 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI