MACROS:
The Beginners Guide
The Beginners Guide
Disclaimer
First off thanks for taking out the time to read this. I would just like to say I don't proclaim to be the best at creating, editing, and using macros but, I do believe this guide will help out any beginner to creating functional macros for any class. Some of you may have never used macros before but to me it's one of the most useful functions Blizz created for the simple fact when it comes down to Top-End raiding or Intense PvP macros can be gamebreaking, Time-Saving, and the most helpiful addon in the game. If you have little or no experience at macroing I suggest reading this guide. Once again thank you and hope this can help.
Slash Commands Edit
To understand how everything else works, you need to know what a Slash Command is. WoW allows you to give simple commands to the game in the form of a slash (/) followed by the name of the command. You can give these commands directly by typing them into the chat box. An example would be the "/follow" command. If you target a friendly and type "/follow" (without the quotes), you start following them. You can get a list of some of the slash commands by typing "/help".
There are several types of slash commands. Some are designed to perform game actions (e.g. /follow, /assist, /cast), others are chat related commands (e.g. /yell, /chatlist) or give you information (/who). You also have emotes (eg /laugh, /bow, /dance).
Finally, there is one very special slash command "/script", explained later.
Macros Edit
The purpose of a Macro is to allow you to create some very simple custom actions or tasks, based on the existing game actions. A macro is just a sequence of slash commands, which are executed in order when you execute the macro. To create a new macro, either type "/macro" (without the quotes), or click on the speech bubble next to the chat box and select macro. You can then give a macro a name, an icon and type in a few lines of slash commands. The macro is created in the form of an action that you can drag onto your hotbar. You can activate the macro by clicking on the resulting button on the hotbar.
An example macro would be:
/cast Fireball(Rank 1)
/say "I am frying it!"
This macro merely casts a fireball, and then has your character tell everyone nearby that you're casting it.
Another example would be:
/console farclip 177
/cast [button:1] Hearthstone
/stopmacro [button:1]
/console farclip 1500
This macro sets your view distance to minimal, then if you left clicked your mouse uses your hearthstone and stops the macro, if you used anything but left click it continues into setting your view distance to furthest. The usefulness of this macro would be if your computer can handle max graphics every where but Dalaran and your hearth is set to Dalaran, if you have problems in Dalaran if you set the view distance to minimal before hearthing it allows a much quicker load time with no lag, the reason to make it so that if you don't left click it it sets your view to max is so that when you leave Dalaran you can click the same button to put your graphics back up to the good looking view.
Macros have some severe limitations, and are only intended for very very simple tasks. The most important limitation is that it is difficult to cast more than one spell at a time using a macro (although it is possible, using API SpellStopCasting). This limitation exists so that macros can't automate too much for you. You can have as many other commands within the 255 character limit as you like.
Scripts Edit
Scripts are small computer programs that manipulate and combine a small number of objects that exist outside the script. Scripts are usually written in a scripting language, which is designed so users can quickly express those small programs in a flexible way.
(Scripting languages are a popular way to teach new programmers, so don't be afraid!)
The World of Warcraft client embeds a powerful scripting language called Lua in its client software. This lets you create specialized commands, similar to the macros described above. However, scripts can be much more complex, making decisions on what to do based on what is going on in the world rather than the fixed sequence offered by a macro.
Lua scripts are used in the following places:
/script [command] : If you type the slash command "/script" in the chat box, you can follow it with one or more valid Lua language statements (i.e. a script), separated by semi-colons ( ; ).
Macros: you can enter scripts as part of macros, by putting one or more "/script" commands in your macro.
Addons: these extend the WoW client with new slash commands and often user interface elements. This additional functionality is provided through Lua scripts (containing the actual addon logic). User interface extensions are defined in XML files. (XML is, incidentally, not a programming language. It's a "mark-up" language which contains source code but can also contain media contents or structured references to external, possibly remote network media resources ... including other XML files. However, XML is stored as structured, syntactically complex text and is parsed and interpreted in ways that make it similar to a programming language).
So what can a script do? There are many resources on Lua scripts. See our page on Lua to find out more about the language. Browse the rest of the Interface Customization page for additional resources. The most important point however is that scripts are able to perform many more game actions than slash commands. This is done via a set of functions (called API or Application Programming Interface) that WoW makes available for use in scripts. There is a quite extensive list of all the API functions available for use in scripts at World of Warcraft API.
After all that explanation, here is an example of a script:
if (IsPartyLeader()) then
ChatFrame1:AddMessage("I am the leader of my party!")
end
This script is very simple. When you execute this script, if you are the party leader, then you get a message saying you are the party leader. To use this script, you would have to do so via the "/script" command. e.g.:
/script if (IsPartyLeader()) then ChatFrame1:AddMessage("I am the leader of my party!"); end
You can type this directly into the chat box, or make that line part of a macro, so that it's reusable.
Summary
In summary: a script in WoW is a short program written in the Lua language, able to interact with the game and perform game actions. You use a script by including it as part of something else, e.g. by putting it in a macro via the /script command, or by putting it in an addon.
Note that Blizzard has taken great efforts to limit the functionality of scripts and macros to prevent players from automating too much of the game play. If too much were automated by some players then they would have have unfair advantages against others in PvP and they'd be able to farm far too quickly which would cause instabilities in a realm's virtual economy (as well as potentially ruining play for other players by having too many of the materials and world drop items rapidly consumed by automated "bot" players.
Post a Comment