Thread Tools Display Modes
02/01/15, 11:48 AM   #1
Faugaun
Join Date: Feb 2015
Posts: 7
Newbie - Should I take the plunge?

OK....well hmmm...I am interested in giving a go at the add-on development world.

Not exactly sure what I am getting into though. Let me give some background on me.

1989'ish I would edit code in qbasic
1995'ish I created website with Angel fire HTML style - it sucked but I was in middle school.
1998'ish I did the script kiddie thing with MUDs
2001 I graduated Highschool and went to college
2001-2002 I took Visual Basic, wrote a calculator program and a hello world program and a few others, Took Cobal wrote some painfully tedious programs with this and Took and failed Java (apparently sleeping through class = fail)...also took a course concepts of programming (basically flowcharts and algorythm design). I then decided computer science made my hobby (computers) less fun and changed majors.
2012 - Coded from scratch a java based hello world android app
2013 - developed decent skills programming in statistical software packages (SAS and R) and I am fairly comfortable with those.

Anyways so I've been thinking about trying out addons though ATM I don't have a project idea and I dunno exactly how big a hole I am jumping into. Reading a few online guides it seems I just need a text editor and to get familiarity with the api functions that I might want to use and the rest seems like formatting, matrixes, and standard program logic (if then else end) and assigning values to functions that are predefined or defining new functions.

OK, well I kinda lied I do have a project idea but its not very well developed...basically a data gathering add-on that creates a data table based on skills and character stats for back end analysis (this wouldn't be pushed to the depository unless I could find a way to incorporate the data analysis component in an automated fashion within the add-on and thus provide useful information to the end user).

I guess what I am interested in knowing:

Will my previous coding help me jump into the addons world or am I starting at a very basic level?
Is there room for another add-on developer or the table is pretty full ATM?
A suggestion on a starter add-on to get me up to speed?
Any other advice you might give a newcomer?

Also it seems there are three main file types utilized

.txt (text editor simple)
.lua (looks like this could be done in notepad and saved in the correct format? Is there a better way, especially for debugging etc...?)
.xml (again like lua this seems like notepad and saving in correct file type? But perhaps there is a better way?)

I think that covers it so thanks in advance.
  Reply With Quote
02/01/15, 12:29 PM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Faugaun View Post
Also it seems there are three main file types utilized

.txt (text editor simple)
.lua (looks like this could be done in notepad and saved in the correct format? Is there a better way, especially for debugging etc...?)
.xml (again like lua this seems like notepad and saving in correct file type? But perhaps there is a better way?)
Welcome!

Good to know links:
Overview to get started:
http://wiki.esoui.com/

Add-on skeleton:
http://www.esoui.com/downloads/info7...leCreator.html

Editor:
http://www.esoui.com/downloads/info5...DevPlugin.html

ESO strings:
http://www.esoui.com/forums/showthread.php?t=1443

For ideas and wishes:
http://www.esoui.com/forums/forumdisplay.php?f=165

Advanced:
Source Code (as documentation)
https://www.dropbox.com/s/26jr2mrg89...6-PTS.zip?dl=0

LUA do's and donot's:
http://www.lua.org/gems/sample.pdf

edit 1: ESO LUA handles string in ANSI. But if a string as a byte sequence is valid utf-8, the game will print it correctly. (If the font contains the chars)
edit 2: LUA is one-based, but slotIndex (bags) is zero-based!

Good Luck

Last edited by votan : 02/01/15 at 12:47 PM.
  Reply With Quote
02/01/15, 12:30 PM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Faugaun View Post
Will my previous coding help me jump into the addons world or am I starting at a very basic level?
Your previous experience will be definitely helpful, because you have an idea how to write code. Now, you have just to learn what are differences between Lua and the language you have used before.
For example: http://www.luafaq.org/gotchas.html

Originally Posted by Faugaun View Post
Is there room for another add-on developer or the table is pretty full ATM?
There is always room for another active addon author.

Originally Posted by Faugaun View Post
A suggestion on a starter add-on to get me up to speed?
It depends what you want to do. If I want to change what is already in UI, I will take a look into the documentation and to EsoUI source code. If I want to add something to the UI, I always check if there is an addon which does similar thing to get reference how it could be done.

Documentation is attached to this posts:
Update 5: http://forums.elderscrollsonline.com/discussion/135893/
Update 6 (PTS): http://forums.elderscrollsonline.com/discussion/148362/

Source:
http://esodata.uesp.net/100010/ (or files EsoUI-1.5.8.zip and EsoUI-1.6-PTS.zip in my Dropbox folder)


Originally Posted by Faugaun View Post
Any other advice you might give a newcomer?
Not really. Just check tutorials here http://wiki.esoui.com/Main_Page, read through code of another addons and try to make some changes. After a while you will have an idea how things work and you can start writing your own addons.

Just a few tips what you should have in mind - if you are going to publish your addons, make sure that they are working alone as well as with other addons. If you are using libraries, do not forget to include them in addon manifest (.txt fle). Make sure that in your code is exposed just what you want to make accessible for other addons, because it will be very difficult to catch bugs when your addon is using global variables which could be easily redefined by another addon. Best practise is making variables and functions local or as keys in one global table.

Originally Posted by Faugaun View Post
Also it seems there are three main file types utilized

.txt (text editor simple)
.lua (looks like this could be done in notepad and saved in the correct format? Is there a better way, especially for debugging etc...?)
.xml (again like lua this seems like notepad and saving in correct file type? But perhaps there is a better way?)

I think that covers it so thanks in advance.
Use some text editor with syntax highlighting, it makes editing code much easier.
Notepad++: http://notepad-plus-plus.org/
PSPad: http://www.pspad.com/
UltraEdit: http://www.ultraedit.com/

Last edited by Garkin : 02/01/15 at 12:33 PM.
  Reply With Quote
02/01/15, 12:31 PM   #4
Faugaun
Join Date: Feb 2015
Posts: 7
Thanks,

I will read these over.
  Reply With Quote
02/01/15, 07:27 PM   #5
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Votan and Garkin pretty much covered it. I just want to add a reference to zgoo, an addon that shows you the complete contents of the global namespace in the game. It lets you see the contents of every global variable, and is invaluable for debugging (among other things).
  Reply With Quote
02/01/15, 07:41 PM   #6
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Welcome !
I created a tutorial for creating a working stamina bar replacement. It starts with explaining the different files & file structure, and well a lot of stuff. It explains every step & every line of code walking through the creation bit by bit. Its very detailed, and thus pretty long. Its broken into 3 parts,
  1. creating the working stamina bar,
  2. working with saved variables (a continuation of the stamina bar project applying savable settings)
  3. creating settings menus (a continuation of the stamina bar, creating settings menus)
The Creating Settings Menus explains about libraries, library structure (how to set them up), how to save & load settings using the saved variables, ...but in the last section the code for "Creating the Settings Menu" uses LibAddonMenu 1.0, which is out of date. I should fix that.

Its posted on the esoui wiki main page or you can find it here: Circonians Stamina Bar Tutorial
  Reply With Quote
02/02/15, 07:42 AM   #7
Faugaun
Join Date: Feb 2015
Posts: 7
Thanks for all the input.

I've read most of the materials provided (sorry circonian I skipped half of your 3rd tutorial ...will come back too it when I'm ready to create settings). I may have skimmed a couple other sections but I think I've got a decent grasp on the bulk of it (well as good as you can without jumping in).

Thanks for the material everyone.

One last question, is there a good text editor for this work on android? I know its an odd question but the bulk of the time I could use for working on this I will only have access to my tablet and a RDP setup just doesn't sound fun.

Edit: Found a few android options with a brief search think I will give this (https://play.google.com/store/apps/d...maScript&hl=en) a shot unless someone has experience with something known to be good.

Last edited by Faugaun : 02/02/15 at 08:08 AM.
  Reply With Quote
02/02/15, 09:13 AM   #8
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Try Turbo Editor (https://play.google.com/store/apps/d...kyn.fileeditor) or DroidEdit (https://play.google.com/store/apps/d....aor.droidedit).
  Reply With Quote
02/02/15, 10:24 AM   #9
Faugaun
Join Date: Feb 2015
Posts: 7
Thanks Garkin,

OK, I have my first add-on in the pipeline, with any luck it will be created, debugged functioning documented and published in a few days and require only a hundred ish lines.

A couple questions that will save me sometime....

Can an add-on access character data if a different character on that account is logged in? My guess is no.

My round-about solution is to create a saved variables file which adds each character individually to the saved variables file. Then the add-on can open the saved variables file and view account wide (after logging in with each character). This sounds logical?

The rest (at least in my head) seems fairly straight forward ATM...a display box some small mathematical logic and a slash command or three.

Title will be Faugaun's ___ ___ calculator. Look for it soon in stores near you.

/grin
  Reply With Quote
02/02/15, 12:41 PM   #10
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
You expected and did it right. You will only have the way to use savedvaribales files to read other character's values, even if they would be logged in you can't read the information (except a few ones if you stand directly in front of them and you are using the interaction key).
  Reply With Quote
02/02/15, 01:11 PM   #11
Faugaun
Join Date: Feb 2015
Posts: 7
Originally Posted by Baertram View Post
You expected and did it right. You will only have the way to use savedvaribales files to read other character's values, even if they would be logged in you can't read the information (except a few ones if you stand directly in front of them and you are using the interaction key).
Errm I think I didn't write clearly

Basically I want to pull the account name that I am logged in under:
Lua Code:
  1. local account = GetDisplayName()
Then pull the character name
Lua Code:
  1. local name = GetUniqueNameForCharacter

For the character and account I am logged into (not players I am interacting with).

Some of these API are undocumeted that I am looking at (worries me a bit).

Anyways I then want to create a data bank in saved variables

{account, name, x, y, z}
{account, name, x, y, z}
{account, name, x, y, z}
{account, name, x, y, z}
...

The idea is that I can log and then perform mathematical operations on variables x,y,z looking at multiple characters.

Then list the individual character information and totals for the account.

The account Id is present in case an install is used for more than one account and to keep these separate

Upon login the add-on would grab info for the character, log it in saved variables (overwriting a previous entry for the account + character (if the character had been previously entered) thus updating the saved variable). This way when I log out of one character and on to another then the add-on can access the stored information from my other characters and perform mathematical operations on the logged on and logged off characters to create accountwide statistics.

Hope this makes more sense.
  Reply With Quote
02/02/15, 02:37 PM   #12
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
You can get information only about character you are currently logged on. It is not possible to query information about offline characters even if they are on the same account.

And for the character name. I don't recommend using GetUniqueNameForCharacter(charecterName). This function will make difficult displaying character name somewhere. This function merely joins character name with server name and thats all (<server>-<character>, "NA Megaserver-Vertol"). As character names are always unique, you don't need it. Use GetUnitName("player") or better GetRawUnitName("player").

As for the saved variables, check comments here:
http://esodata.uesp.net/100010/src/l...dvars.lua.html

Of course, it isn't necessary to use default ZO_SavedVars object if you don't like it. You can use saved variables table directly and create your own data structure. Just do not forget, your saved variables table won't be accessible before EVENT_ADD_ON_LOADED is fired, so you should initialize them in handler for this event.
  Reply With Quote
02/02/15, 02:46 PM   #13
Faugaun
Join Date: Feb 2015
Posts: 7
Sweet! That's great tips.

Thanks again Garkin!

This is gonna be longer than 100 lines now that I am digging in...oh well such is life.
  Reply With Quote
02/02/15, 10:07 PM   #14
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
If I understand correctly then your just wanting to access the "saved variable data" for other characters? You can do that:
Lua Code:
  1. local tSavedVars = _G["JunkItSavedVars"]["Default"][sDisplayName][sUnitName]
Where JunkItSavedVars (is just an example of) the saved variable name you declared in the .txt manifest:
Lua Code:
  1. ## Title: JunkIt
  2. ## APIVersion: 100010
  3. ## OptionalDependsOn: LibAddonMenu-2.0
  4. ## SavedVariables: JunkItSavedVars
  5. ## Version: 2.9
  6. ## Author: Circonian
  7. ## Description: Circonians JunkIt Version 2.9

If you just want a copy of the other characters saved variable table to work with you can make a copy of it like this:
Lua Code:
  1. local tSavedVars = ZO_DeepTableCopy(_G["JunkItSavedVars"]["Default"][sDisplayName][sUnitName])

When they said you couldn't I think they thought you meant you wanted to run API functions to get information about the other character, like GetItemLink(bagId, slotId) to attempt to grab an item link for an item in another characters inventory (can't do that).

EDIT/AFTERTHOUGHT:
You could also just use saved variables with account wide settings & then dump whatever information into it you want which is automatically shared between characters.

By doing something like this (AccountWide/Shared saved variables):
Lua Code:
  1. self.AccountSavedVariables = ZO_SavedVars:NewAccountWide("JunkItSavedVars", JunkIt.version, nil, JunkItAccountDefault)

Instead of this (Character specific saved variables):
Lua Code:
  1. self.SavedVariables = ZO_SavedVars:New("JunkItSavedVars", JunkIt.version, nil, JunkItPlayerDefault)

Or if its data you wanted to keep separate from normal settings you could do what Garkin suggested and create your own tables by accessing it all directly (same way I accessed other chars above), example:
Lua Code:
  1. -- just put whatever you want in there.
  2. _G["JunkItSavedVars"]["SomeTable"] = {}
  3. _G["JunkItSavedVars"]["SomeTable"]["temp"]= {}
  4. _G["JunkItSavedVars"]["SomeTable"]["temp"].test = true

Last edited by circonian : 02/02/15 at 11:35 PM.
  Reply With Quote
02/02/15, 11:38 PM   #15
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Even default ZO_SavedVars allows access to saved variables of the different character - using the GetInterfaceForCharacter method.

For example:
Lua Code:
  1. local savedVars = ZO_SavedVars:New("MySavedVarsGlobalTable", 1, {})
This will create interface for saved variables for current character.
If you want to get data for different character, use:
Lua Code:
  1. local savedVarsForDifferentChar = savedVars:GetInterfaceForCharacter("@displayName", "characterName")
  2. --or account wide settings:
  3. local savedVarsAccountWide = savedVars:GetInterfaceForCharacter("@displayName", "$AccountWide")

However it is more suitable for copying settings from one character to another. It will not help you with iterating over the existing account/character names stored in the table and you will need keep list of chracters somewhere (probably in account wide settings).
  Reply With Quote
02/03/15, 12:06 AM   #16
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Garkin View Post
Even default ZO_SavedVars allows access to saved variables of the different character - using the GetInterfaceForCharacter method.

However it is more suitable for copying settings from one character to another. It will not help you with iterating over the existing account/character names stored in the table and you will need keep list of chracters somewhere (probably in account wide settings).
Nice, learned something new. Didn't know about that one.

But you made me think, so I will also add, in case he wanted/needed to iterate the table without keeping a list of character names, he could do something like this:
Lua Code:
  1. local tAccountData = _G["MySavedVarsGlobalTable"]["Default"]["@displayName"]
  2. for sCharName, tCharSavedVars in pairs(tAccountData) do
  3.     if sCharName ~= "$AccountWide" then
  4.         -- tCharSavedVars = character saved var table for sCharName, do whatever with it
  5.     end
  6. end
  Reply With Quote
02/20/15, 05:34 PM   #17
Kelnoreem
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 11
As a step to learn the ESO addon programming, I created a Hello World addon, which borrowed the separation of code for menu, window, and addon from Rare Fish Tracker (thanks KitKat). There are many addons to learn from, I found RFT was simple and small enough to not get over confused.

This is similar to hello world in other programming languages it shows the zone you are in. While this helped me to learn, my thoughts was it should be a addon to help others to learn ESO addon programming. I added many comments and referenced the wiki where it seem proper. I used it as a skeleton to create a few new addons.

My hope is it will help others, and have feed back to improve it as a Hello World. Take a look at it and let me know if there should be changes. When I added it to esoui, I checked the box so others can update it.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Newbie - Should I take the plunge?


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