While adjusting EventHorizon’s look and feel is pretty straightforward, many users have been completely stumped when trying to add or remove spells from the addon. This is, in part, because the spell bar coding hasn’t been documented in quite a while.
At one point each class config file (more on those in a moment) had instructions within. However, as EventHorizon’s API grew, so did the instructions – If I were to include them within the files now, the instructions would be longer than the configs!
In today’s article we’ll be going over each available setting. A certain level of Lua knowledge will be needed for this, which we covered for the most part in the previous post. Assuming you’ve read and understand it, all that’s needed is a quick interlude to explain how the spell config works.
EventHorizon’s class config files are located in WoW/Interface/AddOns/EventHorizon_ClassName, where ClassName is, of course, the class you intend to change. These files are only loaded if you are playing that class, and are loaded after the general config. This can be useful later on, which I’ll cover in the next section.
The class config creates a function which is called but left undefined within EventHorizon’s core. This function, EventHorizon:InitializeClass(), is a method which assigns the spells to a given class when played.
EventHorizon:InitializeClass() calls multiple instances of another function, self:NewSpell(). NewSpell takes the table that it is given as a parameter (more on that in a moment) and uses that information to create the spell within EH.
The basics:
self is a shortcut for the table that we’re working with. In the case of the class config, self can be replaced with EventHorizon freely. There’s no real reason to use self within the class config aside from being shorter to type, but I feel that it makes it a tiny bit easier to see what’s going on from a novice perspective.
A function is, briefly, a list of instructions to perform with optional returns and parameters. Since this article’s scope is limited to the essentials for the spell config, we won’t delve into it much. It’s enough to know how a function works.
local Foobar – If a value is not specified when declaring a local, the local defaults to “nil”.
local function DoThis() – First declare the function.
local Rawr = “lol” – A local declared within a function cannot be accessed outside the current execution of the function. In other words, this line does absolutely nothing since we’re not doing anything with Rawr. If we tried to use Rawr later, Lua would spew an error.
Foobar = Rawrend – Ending the function.
Functions can also be used as if they are variables through the use of returns. Again, not delving into the topic too much since there’s a good bit to cover here, but be aware that anything below the return line in a class config file will not be executed.
A function aspect to be aware of in this case: parameters. Those parenthesis following a function may be used to provide a function with essential data. With the spell config, we’re giving NewSpell a table which is translated into usable information for EventHorizon’s core.
To recap it all…
IntializeClass() is a function defined within the class config that, when executed, gives EH the spell information for the currently played class.
NewSpell( {table} ) is executed multiple times within InitializeClass, providing usable information to EH for each spell in order. This function uses a table as a parameter to do so.
Due to InitializeClass and NewSpell both existing within the EventHorizon global table, we can use self as a shortcut within InitializeClass for readability’s sake.
Knowledge is half the battle, or so they say. Now that we’ve got an understanding of how the class config works, we’ll take a deep look into what can be done with it.
Myconfig: Since we’re making changes to essential aspects of EventHorizon here, we want to make sure that we’ve got a backup and that we don’t lose those changes in an update. Myconfig is an excellent way of doing that – Just like EH’s general config, make a copy of config.lua and rename that copy to myconfig.lua. You can’t just delete the contents like last time though, since we’re not just changing fields in a table.
Using the class config as another general config: The class config files are loaded after EventHorizon’s core and config files. This lets you change things around in the class config without mucking with conditionals and all that. If you want to change settings or colors, just write in the appropriate code before the function call at the top of the file. You’ll notice that EH’s config is declared for your convenience.
Deleting or moving spells: Easily done. If you want a bar to appear higher or lower in the frame, just move its NewSpell function accordingly. The spells are defined in the order which they appear in EH. To remove a spell from the frame completely, delete its NewSpell entry and you’re all set. Efforts have been made to label each spell with a preceding comment so that they can be found easily. (Little note here, I’ve also tried to be as complete as possible when describing a bar. If you’re not sure why a bar is included in the first place, take a look at the config. Secondary effects have been applied to many, many otherwise pointless bars)
That’s all well and good. Let’s dig deeper and start changing things up.
You’ll need to know how to look up a Spell ID before adding or removing much from a bar. They can be found easily enough via WowHead. To look one up you usually only need the spell’s name.
- Type rupture into the search box. You’ll be greeted with a list of search results.
- Since we’re looking for a usable ability, head to the Abilities tab and click one of the ranks.
- Take a look at the URL bar of your browser. If we picked Rank 1, this would be “http://www.wowhead.com/?spell=1943″.
- The Spell ID is the number at the end.
- Search for fetish of volatile power. It should bring you straight to the trinket’s page.
- Click on the tooltip line saying “Use: …”. This should bring you to another page.
- We’re now looking at the trigger of the effect. This isn’t quite usable – EH will show a tiny marker when you use the trinket, but because the name of the trigger isn’t the same as its effect, we still need to dig deeper. Scroll down a little and look at the Spell Details section.
- You should see a spell name and icon somewhere in there. Click on it and we’ll have the actual buff that’s applied when the trinket is used. For reference, you should be at “http://www.wowhead.com/?spell=67743″, looking at a spell named Volatility.
- This is the one we want. The Spell ID is the set of numbers at the end. While this didn’t take long to look up, you’ll note that the information we needed was buried fairly deep. To make this a little easier in the future, you’ll want to know the name of the buff or debuff beforehand and search for it directly.
- Search for glyph of life tap. You should see three tabs: Items, Professions, and Uncategorized spells.
- Head to the Uncategorized tab.
- You should see two results there, both with the same name but different icons. One is the glyph application, one is the glyph when equipped. We want the equipped version. One way to tell is by looking at the tooltip – The glyph application has a cast time, while the equipped glyph does not. Another way is via the icon itself – Application has a unique icon, while the equipped glyph generally has a golden gear for its icon.
- Once you’ve figured out which one the equipped glyph is, click it and find the Spell ID as normal. Again, it’s at the end of the URL.
Alright, so it’s been over 1500 words and I haven’t even started on the easy stuff. No more examples, on to the variables! Remember, these are case sensitive.
Note that if a variable is boolean, it may still act as if it were true due to how EH checks these settings, even if set to nil. This may change, but in the end it’s best to remove or comment out a line if it’s not required instead of setting its opposite.
Hopefully I’ve covered everything here. Happy modding, and we’ll see you next time!
Previous – EventHorizon Course 3: Pimping EH
You can download EventHorizon here.
If you enjoy the addon, remember that donations are what keeps it alive and evolving. I no longer play the game any more than necessary for testing purposes, and cannot spare the money to keep my WoW account running for that purpose alone.
You must be logged in to post a comment.