Grinding yields the best rewards in a group of two players with xp scrolls/potions and even a ring of mara (Crown Store) to boost the group experience. So where do we get that XP? A good route through Spellscar in Craglorn is currently the best XP on offer but can be crowded, which is where many will recommend Skyreach Catacombs (also Craglorn).
Eso Experience Bar Addon
I would like to say that I hope that you get something out of this tutorial and go on to create great addons. This tutorialcovers the very basics from folder/file structure, events, layers & levels, up to creating a working stamina bar. What followsis by no means the best way to do everything. It is meant for beginners who have no idea how to get started. I have done my bestto check everything for errors, but theres no guaranteee. I'm not an expert but there are limited resources for beginners so I thoughtI would share what I have learned so far. This turned out a LOT longer than I expected it to when I started, but there is a lot of information here. I hope you enjoy, have fun.
You may wonder why I'm using --]] instead of just ]] to end the comment; this is because by simply adding a single - to the start of the opening comment line I can make that into a single-line comment instead of a multi-line comment. The last --]] will then also become a single-line comment, in effect enabling the intervening code. It's a neat trick if you want to comment/uncomment blocks of code while you're testing your addon.
This may seem a little out of order...we haven't talked about any code yet, but this is a pretty important concept for creating addons and it takesmore than a couple of lines to explain. I want us to get it out of the way so when we get to our lua code we can focus on everything else.First some examples of events so that you can have an idea of what an event even is. An event could be something like when you gain experience,when you open up your inventory screen, when you gain/lose stamina, change your target, etc...When an event occurs certain code is run to handle whatever needs to be done for that event.In the example of gaining XP, when that event occurs a certain function somewhere is called in the game that said "oh we gained xp, I better updatethe XP bar." and then it processes the necessary code to do so. In our code events are all capital letters and 'most' words are separated by anunderscore. Here are a few examples:
Now everytime the EVENT_ADD_ON_LOADED event occurs the function I wrote in my addon called CirconianStaminaBar.OnAddOnLoaded will run.You can only register one function to an event.If you try to register multiple functions to the same event only the firstfunction registered to that event will fire. For example if in my code I did:
The first addon you create will probably be the most difficult for you. As of now I'm assuming you know absolutely nothing about what you need towrite in your lua, txt, & xml files so we have a lot to learn just to get anything to work. After you get through your first tutorial andget everything working though it gets a lot easier. We will attempt to work on our stamina bar (status bar) in small steps.
First we have to decide what we want to do. Lets say that our main goal is to create a new stamina bar with our players name above it.This may not seem like the most useful idea for an addon, but we need to learn a few basics without making the code too complicated.
When you create a folder containing your addon it must be placed in that directory in order for it to be loaded by ESO. Each addon must have its own unique folder name.Do note that the name of your addon folder must match the filenames you use for your lua, xml, txt files, and addon name (the name you assign in your lua code file).Well, that's not entirely true there are some exceptions, but this is a beginners tutorial and I want to stick with basics & best practices. There is no reason to randomly name your files and then you can't remember which files belong to which addon. If you follow that rule you wont have any problems.For example the addon I wrote to follow along with this tutorial I named CirconianStaminaBar. So the folder/file structure for it looks like this:
In case your skipping around reading only parts of this I'm going to repeat the following because it is very important!Your addon folder must match the filenames you use for your lua, xml, txt files, and addon name (the name you assign in your lua code file).There are exceptions to that, but this is a beginners tutorial and I want to stick with the basics. If you follow that rule you wont have any problems.For example the addon I wrote to follow along with this tutorial I named CirconianStaminaBar. So the folder/file structure for it looks like this:
.luaThe .lua file contains the lua code that runs your addon. This is where you will do all of your coding. Some addons may have multiple .lua, but for this tutorial we are only going to deal with one of each type of file. Having more than one file is usually done to split up large amounts of code and make it all easier to follow/read/edit..xmlThe .xml file contains the xml code that your addon uses to create controls in your addon. A few examples of controls would be:a text label (just what it sounds like..just some text), a status bar (like a health bar), or an image (a picture you put on the screen).There are of course more types but this is a beginner tutorial and that should give you an idea of what the xml file is used for.The xml file is optional, you can create all of the controls using lua code in your lua file if you want to..txtThe .txt file is what tells ESO what files to load/run to make your addon work.
This should be set to the current API version for ESO. As of this writing (5/25/2014) the current version is 100004. If the most current version number is not used the addon will be considered out-of-date and will not be loaded when a user logs into the game (unless they have the special option to run out of date addons checked, but this option is off by default). How do you know what the most current API version is? Check the esoui wiki main page. _Page
This tells ESO that your addon uses the library LibStub (a versioning library that allows other libraries to easily register themselves and upgrade). The Optional DependsOn part tells ESO that if the user has LibStub installed then your addon wants to use it, but its OPTIONAL. If it doesn't exist, no big deal.We are not going to go into detail about libraries for this tutorial, but LibStub is a library that developers can use.A library is basically just a bunch of code that someone wrote and packaged up so that others can use their functions without having to recreate all of the code themselves.We will not be using this in the beginner tutorial, but I wanted to explain what to explain how to read it in case you see it if you go looking through the code of other addons.
This is the same as above except it tells ESO that your addon DEPENDS on LibAddonMenu-1.0 (a library used to create in game settings windows for your addon).Meaning that you're telling ESO that your addon can not function without it. So if the user does not have LibAddonMenu-1.0 installed your addon will not load.This is to prevent errors from occurring. We are not going to go into detail about libraries for this tutorial, but LibAddonMenu-1.0 is a library that developers can use.A library is basically just a bunch of code that someone wrote and packaged up so that others can use their functions without having to recreate allof the code themselves.We will not be using this in the beginner tutorial, but I wanted to explain what to explain how to read it in case you see it if yougo looking through the code of other addons.
This is used for saving user settings. It tells ESO to save stuff (you have to add certain code to your lua file and tell it what to save) to a variable called CirconianStaminaBarVariables inside of the SavedVariables folder located at:C:\Users\\Documents\Elder Scrolls Online\live\SavedVariablesThe file name that it uses in the SavedVariables folder will be the same name as your addon name.
This where we initialize any variables for our code. At the very least you will have a name for your addon and a version number. Here we store our tutorial name and version number into our table. Do note the table we are storing them in is the empty table we created at the start.
This is the function that WILL fire when our addon is loaded. Note I said that it WILL fire because it does not happen automatically.We must tell ESO to fire this function when the addon loads. We will do that part later. Also note that we are storing this function inour table that is why the name of the function has CirconianStaminaBar. (its hard to see but theres a period after that in front of OnAddOnLoaded.Also know that we could name this anythingwe wanted, but that would just make the code confusing. OnAddOnLoaded makes sense and you dont want to make your code confusing.The function takes two parameters which I've named event and addonName. Both of these parameters are needed because we are going to registerthis function to run when our add on loads. ESO automatically passes the event code and the addon name to any function registered to this event.Also keep in mind that when we register this function to load with the EVENT_ADD_ON_LOADED, it fires when ANY add on is loaded. That is why in ourcode we had to check and see if it was our addon that was loading.ESO automatically passes the event code as the first parameter to every function registered to any event.When you look at events to see what parameters they pass to your functions on esoui wiki it does not show the eventcode being the first parameter, but that is the way it works for every event. 2ff7e9595c
Comments