Locked Home » Forums » Legacy & Archived » Archived Content » Star Wars Galaxies » SWG Premium Discussions

Intro to writing your own macros : SWG Premium Discussions

Posted: March 16th, 2004
Total Posts:10213 Joined:2004
This Guide will serve as a starting point for those of you that think SWG macroes are cool and want to know the basics of writing them.

To begin writing a macro, press Ctrl+a, then click the macro tab, then click new macro. The first thing you will do is name the macro. Then you will select an icon for the macro. I like to use the same icon as whatever command will be excuted in the macro (i.e. I use the /healDamage icon for my healSelf macro). You will be able to tell the macro from the origional command by looking at the border of the icon. Regular commands have a thin solid border, macroes have brackets. It's a subtle difference, but you'll be able to tell with a glance. Lastly write the marco and click ok. That's the big picture, now lets break it down.

First and foremost, name the macro based on it's purpose. If it's going to be used from a toolbar or a hot key then be descriptive with it's name. The game designers like the camel notation format, so we'll use that for consistancy. Camel notation means we start with lowercase and each word change is capitalized for readability (i.e. shuttleBoardingMacro). If you're planning on running the macro from the command line, then use the least amount of letters possible to make it easier to execute (i.e. sbm).

What can I do with a macro? Plenty. Just about everything you can do in-game can be done with a macro, but the most basic uses are equipping/un-equipping weapons and armor. I find the best way to accomplish this is with the first two commands I'll cover. Namely /ui action toolbarPanexx and /ui action toolbarSlotxx. It's these two commands that navigate through the toolbars from within the macro. The xx in toolbarPanexx can range from 00-05, in toolbarSlotxx it ranges from 00-23. What do the numbers mean? The default toolbar is toolbarPane00. This is the toolbar that comes up when you first log into the game. The toolbarPanes can be accessed with Ctrl+F1 through Ctrl+F6 or by clicking the up and down arrows next to the little number in brackets on the upper-left corner of the toolbarPane. The toolbarSlots are F1-F12, by default, but with a little drag of the mouse you can get a second row accessible by Shift+F1-Shift+F12. Just drag the bottom of the toolbar with your mouse and viola. F1-F12 correspond with toolbarSlot00-toolbarSlot11, Shift+F1-Shift+F12 correspond with toolbarSlot12-toolbarSlot23.

Equipping/Un-Equipping can be accomplished by dedicating a toolbarPane to items in inventory. I personally use toolbarPane04. I put all the items I might want to use in this toolbar and then I reference its' location from within the macro. The most common use for this is putting on a full set of armor. Lets walk through this now. A full set of armor would consist of a helm, a left and right upper arm, a left and right lower arm, a chest peice, legs, boots and gloves. Nine items in all. In our example we'll use toolbarPane04. Go to toolbarPane04 by pressing Ctrl+F5 and open your inventory by pressing Ctrl+i. Drag the nine items into the first nine slots in the toolbar (F1-F9). Write the following macro text:
/ui action toolbarPane04;
/ui action toolbarSlot00;
/ui action toolbarSlot01;
/ui action toolbarSlot02;
/ui action toolbarSlot03;
/ui action toolbarSlot04;
/ui action toolbarSlot05;
/ui action toolbarSlot06;
/ui action toolbarSlot07;
/ui action toolbarSlot08;
/ui action toolbarPane00;
Click ok.

Now if you named the macro armor, you can type /macro armor and you'll switch toolbars put all the armor on (or take it off) and switch back to the default toolbar. If you plan to execute the macro from another location, you'll have to change the last toolbarPane address to the location you'll be executing the macro from.

Actions in macroes can be accomplished by using the name of the action found by hovering the mouse over the icon in a toolbarSlot. The most common action being healDamage, lets cover healing ourselves on the fly. Start a new macro, name it healSelf. Click the healDamage icon, it looks like a shaded-in heart with shining marks like the sun. Write the following text:
/healDamage self;
Click ok.

Now place the icon in a toolbarSlot and viola no more targeting yourself to heal, just place the icon in an easy to hit key (F1,F4,F5,F8,F9,F12) and do yourself a favor if you use multiple toolbars be consistant with your placement across all toolbars. There's nothing more annoying than hitting the wrong key because your mele toolbar isn't the same as your ranged toolbar and you forget witch one you're in. It happens, believe me. So in my case healSelf is in F9 on all my combat toolbars, that way when I switch from my pistol to my vibroblade healing myself is still F9 even though the rest of my attack keys have all changed to the corresponding special moves for fencing. I did the same thing for First-Aid, it's F10 because I don't get hit with bleed effects as often as I need healing. The First-Aid macro uses the next cool command, and that's /pause.

Moving right along, with First-Aid, new macro, name it firstAidSelf, click the firstAid icon, write the following text:
/firstAid self;
/pause xx; (45,30,15 adjusted for skill)
/firstAid self;
Click ok.
Now drop the new macro icon in the toolbar and next time you're hit with a bleeding attack, push the F-key you put the icon in and bingo.

Pause does exactly that, pauses the execution of the macro to coincide with events in the game. This is one of the tricky things in macro writing. How do I time the logic of the steps to the internal timing of the game. My best advice is to keep trying till you get it right. As a general rule I will double or halve an interval of time to see it's affect, then tune accordingly by unit.

The last common command I use is /macro <macroName>; . It's used to make a macro loop. All you do is make the last line of any macro you intend to loop /macro <macroName>; where <macroName> is the actual name of the macro. This will cause the macro to call itself as the last thing it does. It's completely possible to call any macro from within any other macro. This can lead to very complicated logic structures with subprocedure calls to other macroes and/or multiple infinite loops. All this goes away with the /dump command.

Due to the fact that I have many macroes that loop I have a /dump macro assigned to a hot key and I press it every once in a while just to see if I have any running command chains.

The last thing I'll tell you is that if you type // and press enter you'll get a list of actions that can be executed within macroes or from the command line.

I hope this covers most of the basics.
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 9 guests