Thread Tools Display Modes
07/15/15, 04:22 PM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
[implemented] api version variable in addon manifest

I was just wondering if it would be possible to add a new variable for the addon manifest so that we can make the addon compatible for both api versions on a major patch without having to clutter the code with
Lua Code:
  1. if(GetAPIVersion() == 100011) then
  2. --old
  3. else
  4. --new
  5. end

Something like
Code:
Startup_${apiversion}.lua
which then loads either Startup_100011.lua or Startup_100012.lua depending on the api version.
 
07/15/15, 11:12 PM   #2
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by sirinsidiator View Post
I was just wondering if it would be possible to add a new variable for the addon manifest so that we can make the addon compatible for both api versions on a major patch without having to clutter the code with
Lua Code:
  1. if(GetAPIVersion() == 100011) then
  2. --old
  3. else
  4. --new
  5. end

Something like
Code:
Startup_${apiversion}.lua
which then loads either Startup_100011.lua or Startup_100012.lua depending on the api version.
Well, api version never goes backwards on live, you would have to remove the redundant file with the next add-on update anyway. I see no problems having add-on tested and prepared on PTS and updated once patch went live.
 
07/16/15, 02:28 AM   #3
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Of course you will remove the old version once it is no longer necessary, but there is also the delay in the update between EU and NA server to think about. That way you could easily upload a version that is compatible with both APIs and make the transition as smooth as can be.
Also it can't hurt to have the addon ready and published for the PTS so people can test your changes beforehand and instead of making a separate addon I would prefer to just have a version that is compatible with both.

Even without this feature I will find a way to do it, but it would be much cleaner this way, because no unnecessary code is loaded.
 
07/16/15, 09:51 AM   #4
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
Originally Posted by sirinsidiator View Post
Also it can't hurt to have the addon ready and published for the PTS so people can test your changes beforehand and instead of making a separate addon
Stop, stop! I can only become so erect. This would be awesome
 
07/17/15, 09:24 AM   #5
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
I went ahead and added an {APIVersion} variable that is substituted with the current version in any paths listed in the addon ToC. I'll try to make a case for this for the next update (2.1).
 
07/17/15, 12:47 PM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Thank you very much! That will come in really handy in the future.
Will this go into one of the next incremental patches, or what else will the variable resolve to in the current live version in case it only makes it into update 2.1?

And just out of curiosity, are there any other substitutions besides ${language}?
 
07/27/15, 09:39 AM   #7
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
This change is slated for the new incremental live patch.
 
07/27/15, 11:07 AM   #8
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
The result of all this will be with the first patch to PTS (not the launch of it) you will be able to type $(APIVersion) in file paths and have it substitute in the API version on both PTS and live.
 
07/27/15, 11:50 AM   #9
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
And just out of curiosity, are there any other substitutions besides ${language}?
The only other valid one is $(languageDirectory)
 
07/29/15, 07:23 AM   #10
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
There is no way to see what a resolved path will look like, right?
${languageDirectory} sounds like it would resolve to "en/"?
Something like
Code:
string resolvedPath = DebugResolveAddonPath(string manifestEntry)
could help with debugging path issues.

Or maybe even add some new functions to AddOnManager so we can build a panel that shows which files are loaded or not loaded and in which order.
Code:
integer numFiles = AddOnManager:GetNumAddOnFiles()
integer addonIndex, string resolvedPath, bool wasLoaded = AddOnManager:GetAddOnFileInfo(integer fileIndex) -- fileIndex reflects the loading order
 
08/13/15, 03:57 AM   #11
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
If an addon is multi api version ready, how to specify supported versions so it does not be shown as "out-dated" for one of the clients?
## APIVersion: 100011 100012
or
## APIVersion: 100011
## APIVersion: 100012
?

What happens, if someone tries
## APIVersion: ${apiversion}

/edit:
tried myself:
None of it works. => Once a new api version goes live, one still has to update the addon manifest for those who can't do that on their own.
May I did not get, what it's good for?!?

Last edited by votan : 08/13/15 at 12:56 PM.
 
08/14/15, 03:58 PM   #12
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
I don't think it marks higher versions as out of date.

So can't you just put the higher version number:
Lua Code:
  1. ## APIVersion: 100012
Then it will not show out of date for 100011 or 100012. I'm pretty sure I did that once before when publishing changes before the patch and it worked.
 
08/14/15, 04:05 PM   #13
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by circonian View Post
I don't think it marks higher versions as out of date.

So can't you just put the higher version number:
Lua Code:
  1. ## APIVersion: 100012
Then it will not show out of date for 100011 or 100012. I'm pretty sure I did that once before when publishing changes before the patch and it worked.
Unfortunately it does.
100012 is "out-dated" for a 100011 client. At least for my EU client.
 
08/14/15, 04:45 PM   #14
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
I must remember wrong. I probably just posted it early with the new api version and let it show out of date until the patch.
 
08/14/15, 05:27 PM   #15
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
edit: Removed due to error.

Last edited by circonian : 08/15/15 at 07:21 PM.
 
08/15/15, 10:43 AM   #16
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
@circonian: I don't think that would help, because the addon gets disabled before the game loads if the "allow out of date addons" checkbox is not checked, so it would only be cosmetic.

Listing multiple versions like in votan's post sounds like a good solution IMHO. Just because it is compatible with a newer API version does not mean it is compatible with the old one... not that it would matter once the new version has been released though.

Btw, has anyone gotten the new variable expansion to work?
I tried several ways but it does not load the file on live or pts.
Writing
Code:
test/test_100011.lua
does load the file without a problem, but none of these do work for .lua or .xml:
Code:
test_${APIVersion}/test.lua
test_${apiversion}/test.lua
test_{APIVersion}/test.lua
test_{apiversion}/test.lua
test/test_${APIVersion}.lua
test/test_${apiversion}.lua
test/test_{APIVersion}.lua
test/test_{apiversion}.lua
test_${APIVersion}.lua
test_${apiversion}.lua
test_{APIVersion}.lua
test_{apiversion}.lua
Am I missing something here?

Last edited by sirinsidiator : 08/15/15 at 10:50 AM.
 
08/15/15, 10:47 AM   #17
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Round braces, not curly
 
08/15/15, 11:28 AM   #18
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
I blame it on the xml.
 
08/15/15, 07:08 PM   #19
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by sirinsidiator View Post
@circonian: I don't think that would help, because the addon gets disabled before the game loads if the "allow out of date addons" checkbox is not checked, so it would only be cosmetic.
Oh your right it gets disabled before, so that code never gets a chance to run. I didn't think of that.
 
08/19/15, 06:46 AM   #20
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
I have succesfully used it on live and PTS.
It is case-sensitive and must be written as Chip said: $(APIVersion)
not $(apiversion) or $(ApiVersion)

As you still have to increase the APIVersion in the manifest (and upload a newer addon) after the update goes live, the only scenario I have found is: Creating an intermediate version addon, which does not scramble saved variables due to breaking changes, if the user allows to run "out-dated" addons.

Another drawback compared to GetAPIVersion() is: You can not say APIVersion>=100012, only APIVersion==100012. So again, once the update goes live, you need to upload a new version, which removes the version substitute again, in hope the next API version will not affect your addon, again.

But migration is definitely better as without the substitute.

Thank You, Chip!
 

ESOUI » Developer Discussions » Wish List » [implemented] api version variable in addon manifest


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off