Most people that have requested a certain thing made have probably experienced this. Somebody that has coding skills has provided you with a snippet of LUA code that does something automatically (for example code that says something every time you successfully cast a spell). One possibility of getting this to run every time you reload your UI or log on would be, of course, to make a macro with /run and press that manually.
What I am going to show you here are twelve easy steps that every computer newbie can execute and that will cause the code to be executed automatically.
- Open Windows Explorer or an equivalent program.
- Browse to your AddOns directory. Its path is <Your WoW Install Directory>\Interface\AddOns (ex.: C:\Games\World of Warcraft\Interface\AddOns).
- Create a new folder. For the sake of recognizing it later, give it a name related to what the code should do (ex.: InnervateSay). This name needs to be unique within your WoW directory and may not contain spaces (at least I think so).
- Open Notepad or a similar editor that uses plain text. Do not use Microsoft Word!
- Copy the .TOC file contents from the bottom of this post into notepad. Replace YourFolderName with whatever your addon is called.
- Open the File menu and choose Save As... .
- Set the file format to "All Files (*.*)"
- Save the file as YourFolderName.toc - this needs to match the name you gave your folder above or the addon will not load.
- Create another new text document in notepad.
- Paste the code you want to run into this file
- Save the file as YourFolderName.lua - the name needs to match what you entered in your TOC file above. Don't forget to set file format to "All Files (*.*)"!
- Done! Restart WoW and your new addon should show in the AddOns list on your character select screen.
TOC file for copy+paste:
If you provide a code snippet that you want the user to execute, please feel free to link to this thread.Code:## Interface: 50400 ## Title: MyAddonTitle YourFolderName.lua
Update 13-10-10: Toc changed to 40000.
Update 38-04-11: Toc changed to 40100.
Update 30-06-11: Toc changed to 40200.
Update 05-12-11: Toc changed to 40300.
Update 28-08-12: Toc changed to 50001.
Update 05-02-14: Toc changed to 50400.