ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Extension to a AddOn (https://www.esoui.com/forums/showthread.php?t=10037)

Nexmar 01/06/22 07:49 PM

Extension to a AddOn
 
Hi

I have tried doing my own AddOn some time ago, mainly easy stuff like automating quest dialogs. My ESO API and LUA knowledge is quite limited and I hope this is the right place to ask my question.

I would like to expand someone elses AddOn with some more functionality. Basically I would like to make a AddOn that depends on someone elses AddOn and does stuff once the other AddOn has some event / update event occur. I know I could just copy the relevant code and checks from the original AddOn over to mine, but I think it would be nicer if I could integrate with the original AddOn.

Example:
The AddOn has registered for an event, the event occurs and the AddOns function gets called, it then evaluates what happened and registers for an update event to call anothe function a bit delayed. Now I want my AddOn to do something once this update event occurs.

Generally I would like to know if this is even possible, or if I should just copy the relevant functions and register my own events and do the same checks the original AddOn does in my AddOn again, leading to more overhead. I guess the easiest would be to edit the original AddOn, but patching my changes in after every update seems stupid.

I hope my idea is not completely stupid, every help is aprectiated.

Masteroshi430 01/06/22 09:59 PM

I have a kind of related question :
If somebody makes a not fully translated addon, can another person just make a language lua file with the same addon name and respecting the folder structure and maintain just his part of the addon ?
I mean the original addon has, let's say 3 folders and the one which adds features has 1 of these folders with one additional file in it, is there a way to for an addon to act like a sort of "delta update" (just add or replace some files in the original addon) instead of replacing the whole original addon folder ?

Baertram 01/06/22 10:30 PM

If the other addon just uses normal EVENT_*whatever callbacks you can just use the same in your addon.
If the other addon does special magic to react on the events and you want to react on that magic of the other addon:
The other addon needs to provide an API for this, a global variable name like "OtherAddon" where you are able to call the API functions e.g. OtherAddon.GetMagicResult1() from your addon.
But you still would need to know "when" the magic was done so you are able to react on it!
For that it needs to use the CALLBACK_MANAGER to fire a callback with a unique name, where you are able to register a CALLBACK_MANAGER:RegisterCallback("uniqueName", yourCallbackFunction) to.

If the other addon does not provide such API or callbacks you cannot do anything expect overwriting the other addons code from your addon. But this also is only available if the otther addons code is global, e.g. you overwrite function OtherAddon.functionName1 with your code.
-> In general this makes no sense as you might destroy the other addon that way! You should not change other addon's code from your addon. Talk to the other dev if she/he can provide API functions and/or callbacks first!

Else you could simply copy the addon and provide a "patched version" where you include your changes.
If the author allowed this in the addon panel you will see the "Other files" tab at the addon, and there you got the possibility to [ Upload Optional Patch | or [Upload Optional Addon ].
Make sure, as you upload the patch/other addon, that the name shows it is a patch or anoher addon based on the old addon. Else one is not able to distinguish the original addon from the patched ones within Minion easily!

If the author did not allow any patches you won't see these buttons and thus cannot simply create a patch. You'd have to create your own addon then. Check the license of the other addon, and if it includes a license follow it rules! If it allows copying and changing of code give credit to the original code/author in your addon description please!
If the license forbids taking the code you are not allowed to and thus would have to build similar code by your own without copying it. Please also give credit then if you take the idea of other addons, this is just fair.
If the license even forbids taking the same idea you need to respect it and talk to to the dev.


Quote:

Originally Posted by Nexmar (Post 45158)
Hi

I have tried doing my own AddOn some time ago, mainly easy stuff like automating quest dialogs. My ESO API and LUA knowledge is quite limited and I hope this is the right place to ask my question.

I would like to expand someone elses AddOn with some more functionality. Basically I would like to make a AddOn that depends on someone elses AddOn and does stuff once the other AddOn has some event / update event occur. I know I could just copy the relevant code and checks from the original AddOn over to mine, but I think it would be nicer if I could integrate with the original AddOn.

Example:
The AddOn has registered for an event, the event occurs and the AddOns function gets called, it then evaluates what happened and registers for an update event to call anothe function a bit delayed. Now I want my AddOn to do something once this update event occurs.

Generally I would like to know if this is even possible, or if I should just copy the relevant functions and register my own events and do the same checks the original AddOn does in my AddOn again, leading to more overhead. I guess the easiest would be to edit the original AddOn, but patching my changes in after every update seems stupid.

I hope my idea is not completely stupid, every help is aprectiated.


Baertram 01/06/22 10:32 PM

If you manually install the addon, then yes. If you manually install your addons you are able to selectively extract files from the zip archive and you are most likely not deleting the whole installed addon folder (allthough you should as there can be errors if you do not replace all files and folders of addons, as sometimes folder and filenames change, and the contents of old files (which were deleted by the dev) will trouble contents of new files!

If you do this via Minion: No!
Minion will delete the original foldername in live/AddOns as you install/update it and thus the old files are gone and only the new files will be added. So all old files will be missing then, leaving you only with the patched new files.

That said: Patches should ALWAYS include the original files of the addon that your patch is based on + e.g. newer files and folder added!
Minion/manual install should always remove the live/AddOns/<addonName> folder completely and the zip archive should be fully extracted so that all files and folders are updated.

Language patches (with standalone language files e.g. de.lua, fr.lua, etc.) should be forwarded to the addon dev so she/he will be able to officially include the new files in the localization folder. Or if the translations are only texts (if the addon is not following the normal ZOs localization way like described here: https://wiki.esoui.com/How_to_add_localization_support ) she/he needs to update them in the existing lua files.


Quote:

Originally Posted by Masteroshi430 (Post 45159)
I have a kind of related question :
If somebody makes a not fully translated addon, can another person just make a language lua file with the same addon name and respecting the folder structure and maintain just his part of the addon ?
I mean the original addon has, let's say 3 folders and the one which adds features has 1 of these folders with one additional file in it, is there a way to for an addon to act like a sort of "delta update" (just add or replace some files in the original addon) instead of replacing the whole original addon folder ?


Nexmar 01/07/22 05:20 AM

The AddOn does some magic, yes, I know I could otherwise just use the normal event.
I can see the original AddOn uses callbacks to interact with LibGPS, registers some "OnWorldMapChanged" event and fires on this call back. I had a look at (https://wiki.esoui.com/AddOn_Quick_Questions), I am not quite sure I understand how callback work, but it does not seem like I can use them in my case. Truth be told, what I want to do is very specific, so no reason to have an interface for this available.

I could ask the author to add callbacks, but then again, very specific and only one very limited use for it. The AddOn has no license as far as I can see and my changes are for personal use only anyway. I guess I will just add my 3 lines of code every time it updates.

Thank you for the detailed explanation, really educational how these things work.



Quote:

Originally Posted by Baertram (Post 45160)
If the other addon just uses normal EVENT_*whatever callbacks you can just use the same in your addon.
If the other addon does special magic to react on the events and you want to react on that magic of the other addon:
The other addon needs to provide an API for this, a global variable name like "OtherAddon" where you are able to call the API functions e.g. OtherAddon.GetMagicResult1() from your addon.
But you still would need to know "when" the magic was done so you are able to react on it!
For that it needs to use the CALLBACK_MANAGER to fire a callback with a unique name, where you are able to register a CALLBACK_MANAGER:RegisterCallback("uniqueName", yourCallbackFunction) to.

If the other addon does not provide such API or callbacks you cannot do anything expect overwriting the other addons code from your addon. But this also is only available if the otther addons code is global, e.g. you overwrite function OtherAddon.functionName1 with your code.
-> In general this makes no sense as you might destroy the other addon that way! You should not change other addon's code from your addon. Talk to the other dev if she/he can provide API functions and/or callbacks first!

Else you could simply copy the addon and provide a "patched version" where you include your changes.
If the author allowed this in the addon panel you will see the "Other files" tab at the addon, and there you got the possibility to [ Upload Optional Patch | or [Upload Optional Addon ].
Make sure, as you upload the patch/other addon, that the name shows it is a patch or anoher addon based on the old addon. Else one is not able to distinguish the original addon from the patched ones within Minion easily!

If the author did not allow any patches you won't see these buttons and thus cannot simply create a patch. You'd have to create your own addon then. Check the license of the other addon, and if it includes a license follow it rules! If it allows copying and changing of code give credit to the original code/author in your addon description please!
If the license forbids taking the code you are not allowed to and thus would have to build similar code by your own without copying it. Please also give credit then if you take the idea of other addons, this is just fair.
If the license even forbids taking the same idea you need to respect it and talk to to the dev.



All times are GMT -6. The time now is 06:28 PM.

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