View Single Post
06-21-05, 01:33 PM   #5
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
Section 4: "Marco?" "Polo!" "I mean Macro!"
(creating / using Macros)

Q: How do I create a macro? (credit to Trimble)

A: In a chat box, start by typing /macro. then click NEW, give it a name and an icon, and then start entering some commands.


Q: What is the best way to know the exact spelling of a spell to cast? (credit to Trimble)

A: Open your spellbook along side your macro editor. Position the edit cursor in the macro window, and then hold down the SHIFT key while you LEFT click on a spell icon in your spellbook, and the game will type in the correct /cast spellname command for you. You can then cut/paste or edit it if needed.


Q: How can I make a conditional macro? (credit to Trimble)

A: To use conditionals, you'll need to invoke the LUA interpreter. To do that, you start a macro with "/script" Anything after /script will be run as lua code (or a 'chunk' as lua calls it). It is VERY important to keep all parts of a Lua chunk on ONE LINE in a macro, and make it fit within 255 characters.

You can then use the "if then end" codeblock to complete your macro. it should look similar to this when you're done:

/script if UnitName('target') == 'fred' then CastSpellByName('Healing Touch(Rank 1)') end

Note the use of "end" at the end. it's important to Lua.

Also, note that when using Lua code, you can't use /cast to cast a spell - you have to use the CastSpellByName() "function". Luckily, CastSpellByName accepts the exact spelling of the spellname given to you by the shift-click method I mentioned above (remember, you can cut and paste after using the shift-click trick). Additionally, there is another function called CastSpell(), but you must know the SPELL NUMBER to use it.

Also notice the part that says 'target'. this is a placeholder that WoW uses to represent whatever your target it. It's a kind of variable, but it isn't a Lua variable. Other placeholders are 'player', meaning yourself (no matter what your name is), 'party1' through 'party4' meaning your groupmates, and 'pet' which means your pet. MANY wow Lua functions accept these placeholders as arguments, but they are NOT Lua variables - they are more like literals to Lua. This means that while UnitName('player') is valid, UnitName(player) is not valid unless you created a Lua variable called player and did a statement like this player = 'player' to make it contain a valid placeholder value.


Q: When using Lua script code, do I need to end each line with a semicolon? (credit to Trimble)

A: Lua doesn't require this, but you may do so if you like. It does make it easier to read, but Lua does have strict enough syntax that it can understand commands without semicolons. Even something as ugly as this is legal: /script a =5 b =6 Message(a..b)c= a +b


Q: Can I make a conditional macro that does something if I have a certain buff? (credit to Trimble)

A: It's possible, but WoW's UI doesn't come with a simple function to check for a buff. There are ways to do it, but it's tricky. The best way is to use an addon that provides this function and then use it in your macros.

NOTE: Do a search on curse-gaming.com for the IsBuffActive AddOn; this will provide you with an extremely simple method of checking for buffs on yourself or others.

Last edited by Cairenn : 07-03-05 at 08:51 PM.
  Reply With Quote