Here's an excert from a tutorial series on macro-making that I made for for one of the groups I am in. Maybe someday I'll polish up the whole series and put it in the wiki.
-----
Thus far we've used static numbers in our macros, aside from our roll
queries. Time to kick it up a notch and start using Attributes in our
macros!
An attribute is anything that isn't an ability. This tutorial deals with attributes that
you control.
Setting
attributes is simple. Open your character journal, click on
'Attributes & Abilities', and then click on +Add next to Attributes.
Fill in the needed values, there's no special button to click to save
your work. Below Is part of Adara's Attributes & Abilities to give
you an idea of what you can do.
Here
I insert a caveat: In games with a 'Character Sheet' enabled, the sheet
can cause confusion to your Attributes & Abilities page
because a character sheet is just a really really REALLY complicated
version of the A&A tab. Just be careful here.
Once
you've added some attributes, we can start using them in macros. The
code below assumes you're using Abilities for your macros.
@{attribute} [Pulls Current value]
@{attribute|max} [Pulls Max value, if set]
WARNING:
Attempting to reference an unset attribute will cause your macro to
fail to execute and then you'll be unhappy. Don't be unhappy, make sure
all your attributes have values./em attacks with his longsword! He hits AC [[1d20 +@{HalfLevel} +@{Str} +?{Modifier to Hit|0}]] for a potential [[1d10 + @{Str} + ?{Modifier to Damage|0}]] damage.
/em attempts an Acrobatics check: [[1d20 + @{Acrobatics} + ?{TempMods|0}]]
/em attacks with Clever Strike. She hits AC [[1d20 +@{HalfLevel} +@{Dex} + ?{Modifier to Hit|0}]] for [[1d6 + @{Dex} + ?{Modifier to Damage|0} + ?{Sneak?|[NH]2d6} ]] potential damage.
The
benefit to this approach is mainly for longer-term campaigns. Instead
of editing your macros, you edit your attributes. Additionally, I
discovered that once I started building macros in this style, I started
better understanding the mechanics of 4e. The attack macros above are
actually incomplete for 4e, leaving out a lot of numbers that need to be
input. If you decide you want to explore further, I will post a
tutorial specifically on how to write your attack powers for 4e with
this method.
This is where the second benefit of using Abilities
rather than Macros comes into play. Because these macros are attached to a
specific character, the code parser only looks at this specific
character journal for the attributes you are referencing. To use
attributes in a non-attribute macro, you have to specify the character
you wish to pull from:
@{Adara|HP}
@{Adara|HalfLevel}