Clan Lord MacrosNoivad’s Example Macros Welcome Clanners!Codus: “Welcome, @my.name! I can teach you to make new macros
and fix your old ones. You have much to learn.” ZAP! Okay here’s all the basics in the Macro File: Escape Sequences What is an escape sequence? Well, simply it’s a command that takes you
out of a running process. The process that’s running in this case is
text insertion of things between the quotes
(more accurately the inch marks - but let’s keep proper typography out of this)
into the text field we all know and love and type into.
Special Macro keys are keys which, when you hit them, the macro acts automatically without you having to hit Return. They are most useful for quickly switching weapons, posing, pulling & pushing, or doing anything that you need to do quickly and can’t take your eyes off the screen too long, nor your fingers off the mouse/trackpad. Macro key modifiers
You can also use modifier keys with your macros: option-s "this fails" option-ß "this succeeds" will set the text to “this succeeds” when you hit option-s. The “ß” above is one of those lovely upper ASCII characters. Examples:
These are my settings for the first bank of F-keys. You’ll notice a few things which are the basics of this new macro language which has many a 0-Mentus exile baffled. f1 First you’ll note the addition of a few quotes (inch marks).
Next, if you aren’t paying attention you might miss the space
after the command (“ Here’s a quick (okay, not so quick) example of the wrong way (without the space): You’re in noids fighting a Greenie when a clumsy exile decides it’s a good time to stand behind you after you’ve swung out, thus blocking any chance you’ll be able to avoid the now angry Green Noid’s pinchers. We’ll call this clumsy person “Clum”. So you highlight Clum with a quick cmd-click and hit F1.
What you get without the space is “ The next fundamental thing to note is the quote marks come in sets:
the first encompasses the command and the trailing space,
the last set encompasses the escape sequence command “return”.
Without the
Now you’ll notice the addition of a quote set encompassing a space. This is so that the command won’t come out "/thinkto clumget out of my way!" [Message: Clumget is not in the lands.]
This is the next lesson: for multiple @commands in a row you must make sure to
pad them by placing Here’s what it probably looks like: // macro expansions (shorthand is case sensitive) // command lines that start with the shorthand are expanded. "??" "/help" @text "\r" "aa" "/action " @text "\r" "gg" "/give " @text "\r" "ii" "/info " @text "\r" "kk" "/karma " @text "\r" "mm" "/money " @text "\r" "nn" "/news " @text "\r" "pp" "/ponder " @text "\r" "sh" "/share " @text "\r" "sl" "/sleep " @text "\r" "t" "/think " @text "\r" "tt" "/thinkto " @text "\r" "th" "/thank " @text "\r" "ui" "/useitem " @text "\r" "uu" "/use " @text "\r" "un" "unshare " @text "\r" "w" "/who " @text "\r" "wh" "/whisper " @text "\r" "yy" "/yell " @text "\r" Notice the use of good formatting techniques. It’s always important to use them to make it easy on yourself later when you wish to edit. Sleep macro The next macro I got off the newsgroup, then changed it a bit. It’s for when you want to leave the Clan Lord client unattended for more than the 10 minutes the server is set to disconnect idle people. So, go ahead, make breakfast; go to the store to buy more Coke; maybe even, GASP!, relieve that bladder pressure, too!
Okay, “here’s the whole ball of yarn”, as a certain one-eared kyttyn might say after playing with her Dead Lucero yarn ball and keychain. Note the proper formatting that matches the levels of commands with an indent for each command that is a subset of another.
1 The first line starts differently; you’ll notice that the shorthand "sl" is the only thing on that line because...
2
When you’re setting up complex commands it’s often easier to break them up into lines.
But in order for the macro language to understand them as a single macro,
not a bunch of erroneous macros, you have to enclose them in curly brackets
3 Either pressing a key or clicking the mouse button in the game window will halt the macro.
5 Here you are initializing a counter to keep track of how many times you go through a loop. It’s important to note that you initialize the count outside the loop. To initialize the counter inside the loop would cause a nasty endless loop since you’ll constantly be setting the counter to zero!
6
Note the "
7 Pauses are a nice way to separate commands that are chained together so it gives other people time to read multiple dialogs. The number is how many frames to wait before moving on to the next command. Roughly, 5 frames is 1.25 seconds during off-peak, and 1.66 seconds on-peak (6-9PM CDT).
8 This means that you are labeling this point in the macro “start” so you can return to that point from a later command. It’s good to label functions when you are building complex scripts so that instead of a shotgun style, linear script that has many repeated commands, you can simply call a nice little code nugget and save your wrists (for important things — like perfecting your running-beasts-in-a-circle technique).
12
The first run through the “start” function, the counter is zero,
as it was set in line 3. This line means: as long as the count is less than 15,
do the following commands. If the counter is equal to or greater than 15,
the macro interpreter will instead skip to the
13 Now one is added to the counter. Each pass through the counter will add one more. Without line 11 to add to the counter, the loop would keep running forever, since the counter would never reach 15.
14 Wait for 500 frames (approximately 125 seconds), then continue.
15 You aren’t forgetting the spaces after commands, are you?
16 Next after the ponder command, there’s a complex command within the macro. When you place a command within another command, it’s called "nesting". Note that all the lines of this nested command are lined up with each other vertically on the left, so if the programmer wants to change anything he or she can easily isolate separate commands of complex macros.
17
"random" with the use of the "or" makes for some very powerful possibilities.
If you nested function calls in each statement
you could mimic life while you’re out getting pizza.
18
These are the possibilities of
25 Don’t forget to close your function. This bracket matches up with line 16. Now the value of vertically aligning functions should be making itself clear.
27
Here you are telling the interpreter to go back to the
28
Without an
29 Yup, a closing bracket to match the one in line 2 of the macro, just as Gaia intended. Hopefully, the rest of this tutorial should be easier to digest now. Think and thinkto macros These /think and /thinkto macros are executed two ways, depending on whether the item is the same ("==") or not the same ("!="). "t" // think macro { if @my.left_item == "sunstone" // If the item in the left hand is a sunstone... "/think " @text "\r" else set saveItem @my.left_item // save whatever is in the left hand equip "Sunstone" pause 1 "/think " @text "\r" pause 1 equip saveItem // re-equip whatever was saved end if } "tt" // thinkto macro { if @my.left_item != "sunstone" set saveItem @my.left_item equip "Sunstone" pause 1 "/thinkto " @selplayer.simple_name " " @text "\r" pause 1 equip saveItem else "/thinkto " @selplayer.simple_name " " @text "\r" end if } Check the time macro Entil’Zha, BU’s Earth Draka, wanted a quick macro to check the time and then re-equip whatever she was holding before the swap. I quickly modified the healer’s moonstone swap macro from the old "Macro Instructions" file and gave her this "time" macro.
Let’s quickly break it down.
1
The
4
5 After you equip or unequip an item, it takes a moment for the client to relay the command to the server and be free for input again. So, if you chain these commands without placing pauses in, you’ll get the "MACRO Execution Error. Busy; add a pause" error. At best you don’t change the item, at worst you don’t change the item and it causes your death.
6 Now you tell the parser to equip whatever was originally in your hand back when you first started the macro, by calling the variable that you set in line 3.
9 How many times have you set up a chain command before entering a dangerous area, only to retype it and screw up chaining that exile and almost killing yourself in the process? Well, that’s why these are here: "un" "/unshare " @text "\r" "w" "/who " @text "\r" "wh" "/whisper " @text "\r" "y" "/yell " @text "\r" One last thing. Notice all my macros are in alphabetical order, so when I want to edit one, I don’t have to go looking all over the file for it. A little effort designed into something is worth all the headaches not doing it may cause later. It’s one of my rules to live by. I hope this answers more questions than it creates, and that you feel as comfortable scripting in new macros as I do. I really don’t use a lot of them, which you could see if I posted my character’s macro file. However, those that I do use, and have taken the time to figure out, have saved my bacon a thousand times over. Just ask Clum. |