GEM/Macros

Macros
Maptools has pretty detailed macro system; it's not pretty, but it can do quite a lot.

The big reference guide for Maptools Macros is essential if you're doing more complex things.

What is a Macro?
A macro is some text saved to a button (usually on your character token). You push the button, and the text is sent to chat just as if you had typed it. A macro is always and only one chat message, but you can use HTML formatting to break it up into multiple lines (and otherwise make it pretty).

Why A Macro?
Do you find yourself typing the same thing over and over again? Do you find yourself making the same typos over and over again and you're getting sick of it? A macro may be for you.

You can put anything you can put into chat into a macro. Plain text, HTML, dice rolls, anything that goes into chat goes into a macro. The reverse is also true: anything you can put in a macro you can put in chat. Maptools commands can do more than make text come out from chat, but they're all entered as text in the chat or into a macro.

How do I make a Macro?
Here is a quick example of a very basic macro. Prerequisites: Have a token. Make sure you can see the Selected tab (if not, go to the menu Windows -> Selected).
 * 1) Select your token.
 * 2) Right click on the Selected tab space and pick "Add New Macro" from the menu. A new button appears.
 * 3) Right click on the "(new)" button you just made and pick Edit.
 * 4) In the new window that opens, go to the label box and replace "(new)" with "My First Macro".
 * 5) In the Command box type "Hello World!".
 * 6) Click OK.
 * 7) The "(new)" button has now been renamed "My First Macro". Click on it a few times!

How do I make a Useful Macro?
Skill roll macro

OK, so "Hello World!" isn't a very useful macro. Edit your macro again and put this in. Click OK.

[H: Success = input("SkillName | Skill | Skill Name","SkillLevel | 10 | Skill Level", "Mods | 0 | Any modifiers to skill","Cap | 0 | Maximum skill cap (leave zero if not applicable)")] [H: abort(Success)] [r:SkillName] ([r:SkillLevel]): [R,IF(Cap==0),CODE:{ [T:sk(SkillLevel,Mods)] };{ [T:sk(SkillLevel,Mods,Cap)] }] Click on the macro!

Lets walk through what happened here.

The stuff in is hidden in chat. Here, messages to you when you're editing the macro to remind yourself what everything does - so you don't need to spam chat with them. [H: Success = input("SkillName | Skill | Skill Name","SkillLevel | 10 | Skill Level", "Mods | 0 | Any modifiers to skill","Cap | 0 | Maximum skill cap (leave zero if not applicable)")] This is in square brackets - this means it is a command for Maptools. The first part, the H: is a roll option to hide the output. This command outputs a 1 or a 0 depending on if you canceled or accepted, and we don't need that in chat. You could also wrap this in s. We're saving that output to a variable called Success to check later, so we don't need to see it.

The command itself is the input(...) bit. The input(...) function pops up a dialogue box for you to fill in some information, and saves that in variables to use elsewhere in the macro. In this case it asks for four things: the name of a skill, the skill level, any modifiers, and if there's a skill cap.

Then it prints out the name and the skill level nicely: the R: roll option means to only print the Result, with no tooltip. This is useful when you're just printing out a name or a number, because you don't really care what the name of the variable was :P

Then it does some dice rolling for you, and puts that all in the output. The IF,CODE: roll option checks if we put a cap on the skill roll or not, and rolls one way if we did, and another way if we didn't. The T: means to have a nice ''tooltip. ''You can put lots of options in the tooltip if you want to get fancy, see the reference wiki linked above.

This macro means you never really have to worry about typing in a roll code again. Hurray!

Attack roll macro

If you have a weapon you use frequently and you're like me, you are probably going to get tired of typing in the weapon skill name and level all the time. Also, there's rolling damage. For this, you probably actually want less options. [h: Attack = "Broadsword swing"] [h: SkillLevel = 14] [h: Damage = "1d6+2"] [h: DamageType = "cut" ] [H: Success = input("null | " + Attack + " (" + SkillLevel + ") " + Damage + " " + DamageType +" | Attack|LABEL","Mods | 0 | Any modifiers to skill","Cap | 0 | Maximum skill cap (leave zero if not applicable)","DamageModifiers | 0 | Any modifiers to damage")] [H: abort(Success)] [r:Attack] ([r:SkillLevel]): [R,IF(Cap==0),CODE:{ [T:a(SkillLevel,Mods)] };{ [T:a(SkillLevel,Mods,Cap)] }] doing [t:eval(Damage)+ DamageModifiers ] [r:DamageType] This macro is in two parts. The first bit at the top is setting up variables with some pre-set information you don't want to be asked about each time. Then the second bit is like the macro we just saw, where we ask for any modifiers, then roll things.

With this set up, you can make one macro for each attack, and the only things you need to change are up at the top instead of hidden in a bunch of macro code. It also makes them easy to update when you get a better weapon, or improve your skill.

Important note: If you read carefully, you'll see that this macro is using the a function to roll your actual skill check, instead of sk. sk does plain Skill checks. Attacks are a kind of skill check, the a function just adds a feature where if your modified skill is over 18 (the maximum effective skill), it will automatically calculate a Deceptive Attack for you to bring your final skill down to 18 or 17, and announce it. Deceptive Attacks are key in GURPS to how a high-skill fighter defeats his opponents defenses, so you want this if you can.

You may always choose your own Deceptive Attack, and you can choose a more extreme trade off. I chose 18 as the cut-off as a conservative choice so the computer doesn't make you risk more than you intended.