Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Using Variables in macros

I don't know if this is possible, but I thought I would check with the forums and see. I want to create a bunch of ability macros that are not tied to any particular character/spell/weapon/whatever that my players can cut and paste onto thier sheets and then customize. What would really make this work easier for them is if I could use some variables at the top of the macro that the players could customize. For example: WeaponName = "Short Sword" DamageDie = "1D6" /me attacks with my WeaponName /roll DamageDie Any way to do this?
1493819467
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Not the way you want to. You can reuse roll queries throughout a macro/ability, but they'll have to answer each time.
Often, Character Sheets will allow players to easily build their own macros for weapon attacks by filling in fields. Is your Game using a Character Sheet?
1493832515

Edited 1493832731
Variables of the sort you want are stored in characters as attributes. Players add attributes named "Weapon Name" and "Damage Die" to their characters. For instance, Bill the Unbelievable adds an attribute called "Weapon Name" with the value "Short Sword" and one called "Damage Die" with the value "1d6". Then they copy the following into abilities on their characters: /me attacks with my @{Weapon Name} /roll @{Damage Die} They don't have to edit the ability at all, just the values of the attributes. When Bill uses the ability, he'll see: Bill the Unbelievable attacks with my Short Sword Bill the Unbelievable rolling 1d6: [etc.]
I personally use macros like this as I don't care for the character page buttons: /me strikes with his Greatsword &{template:default} {{name=Melee Attack}} ♦ Hit:=[[1d20cs>19 + 2[STR] + 4[BAB] +0[WeaponBonus] + ?{AttackMod|0} ]] ♦ Dmg:=[[2d6 + 2[STR] + 0[WeaponBonus] + ?{DamageMod|0} ]] ♦ Confirm:=[[1d20cs>19 + 2[STR] + 4[BAB] +0[WeaponBonus] + ?{AttackMod|0} ]] ♦ Extra CritDmg:=[[2d6 + 2[STR] + 0[WeaponBonus] + ?{DamageMod|0}]] With something like this you can effectivly tailor the macro to whatever inane need you have. Personally I make use of them for when I run a summoner who's spamming tokens each with their own quirks, buffs, and de-buffs that need to be individually accounted for.