Tuesday, March 1, 2011

Shutting up addons.

Anyone who plays with even a few addons in WoW is probably familiar with an addon having some sort of message to display to you when you log in. I personally hate these messages, especially since they tend to obscure whatever the Guild Message of the Day is. So I set out to get rid of them without getting rid of the addon.

You see, there are two things that you need to know about addons:

  1. when you download an addon, you are literally downloading the source code
  2. and there are no restrictions that say that you aren't allowed to edit this code.
So all we need to do is find the lines of code that print out these messages and remove them.

Step 1: Find which addons are doing it.

"TidyPlates welcomes you back, Gryllz!"
"Rawr version Loaded."

So now I know that I will need to edit TidyPlates and Rawr.

Step 2: Find those addons in your filesystem.

For me, in Windows 7, WoW is stored at C:\Users\Public\Games\World of Warcraft. I believe that for Windows XP users it wll be in your program files. Once you're in the WoW folder go into the Interface folder and then the AddOns folder from there. Here you will have at least one folder for every addon you've downloaded.

Step 3: Open the .lua file for that addon.

I opened up my TidyPlates folder and inside there were 4 different .lua files: TidyPlatesCore.lua, TidyPlatesDefaults.lua, TidyPlatesPanel.lua, and TidyPlatesUtility.lua. Chances are the appropriate file will be the 'core' file. Some addons only have one file or they'll have a file that is simply the name of the addon with nothing else. Those are probably the appropriate files. You'll probably need to right click the file and open it with WordPad. Notepad is too basic and makes this process more difficult.

Step 4: Find the offending code.

Search for some word or phrase that gives away what line of code prints the message. This will vary from addon to addon. For the TidyPlates example I would search for 'welcomes you back' and for the Rawr example I would search for 'Loaded.' (note that I included the period there). Avoid searching for addon names, version numbers, or character names.

In Rawr, the line that I found was

self:Print(self.version..L[" Loaded."])

So it's going to print out it's version and then 'Loaded.'. Perfect.

Step 5: Removing the code.

Deletion is definitely one way to do this, but there is a better/safer way. Suppose you deleted the code and you picked the wrong line, that could screw up the addon and you'd have to reinstall it. That's no fun. Instead what we'll do is comment the code out.

For those who don't know, in computer code there are lines called 'comments' which are strictly there for the programmers and any person who is reading the code. They are skipped over by the computer when it's reading it. In Lua, the programming language used for WoW addons, any line that starts with two hyphens ( -- ) is a comment. 'Commenting code out' is turning legitimate code into a comment so that the computer won't run it. This is done for a variety of reasons: the code may be buggy, experimental, or the developer may just be trying a different approach to the same problem. You comment code out because you don't want to run it, but you don't want to delete it.

Once you've found the line of code that you want to remove, place two hyphens at the front of it. 

This should keep it from printing the message when it loads.

Optional but important Step 6: Being careful.

What if you commented out the wrong line of code? What if you broke the addon? What if you can't find it again? These are all valid concerns which brings us to our next step. Add a new line right after (or before) the one that you edited as a comment that says something that you'll be able to easily find later. I added 


my character's name. My character's name shouldn't show up in their code anywhere so if I do a ctrl+f search for it, I'll know exactly what line I commented out earlier and be able to undo whatever I did.

Just to recap, that part of the Rawr code on my computer now looks like 

--self:Print(self.version..L[" Loaded."])

Final Step: Checking your work.

Save the file you edited and either log into a character or /reload your interface.

I hope that helps you all. Have fun!