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

My Macros ^.^ Spell Book, Attack Targeting Macros and more ^>^ I will update when I make more :)

Here is some of my macros I use in our DND campaign.   This is a cantrip spell page.  Green Flame Blade, and Fire Bolt are macros also, they are posted below. Once you save this in a macro it will be uneditable without repasting the macro.  This is due to "(!
%|#INSERTMACRONAMEHERE })"  You need the #13;%| in the beginning and the &#125 at the end for correct formating, otherwise it casts the spell instead of listing them.  This is also the same for other macros I use.   Cantrip Spellbook Macro /w @{selected|character_name} &{template:default} {{name=Cantrip Spells}}{{=[@{selected|repeating_spell-cantrip_$0_spellname}](!
%|#Greenflameblade }) [@{selected|repeating_spell-cantrip_$1_spellname}](!
%|#Firebolt })[@{selected|repeating_spell-cantrip_$2_spellname}](~selected|repeating_spell-cantrip_$2_spell) [@{selected|repeating_spell-cantrip_$3_spellname}](~selected|repeating_spell-cantrip_$3_spell)}} This macro uses targeting and puts the target in the description with some flavor text.  You must have your token selected while using this macro or the macro errors out.  Once you select your token, then click the macro it will ask for a target.  Mouse over another token and click it,  This will set the target and fire the macro.  Damage, and crit must be turned onto auto.  It does not level up though, I haven't done that yet.  I will update when I do. The name MUST BE Firebolt if you want it to work with my cantrip macro. Firebolt Macro @{selected|wtype}&{template:atkdmg} {{mod=@{selected|spell_attack_bonus}}} {{rname=@{selected|repeating_spell-cantrip_$1_spellname}}} {{r1=[[@{selected|d20}+@{selected|spell_attack_bonus}]]}} @{selected|rtype}cs>20 + (@{selected|spell_attack_bonus})]]}} &{{attack=1}} {{range=}} {{damage=[[1d10]]}} {{dmg1flag=1}} {{dmg1=[[1d10]]}} {{dmg1type=fire}} {{dmg2=}}} {{dmg2type=}} {{crit1=[[1d10]]}} {{crit2=}} 0 {{desc=@{selected|token_name} targets ***@{target|foe|token_name}*** and casts **@{selected|repeating_spell-cantrip_$1_spellname}**}} {{charname=@{selected|character_name}}} Greenflameblade is part of Sword Coast Adventures guide.  This macro is not scaled to level yet either.  Will update when I do.  This one also sets targets.  You must have your token selected.  Then click the macro, select your 2 targets.  If you only have 1 then click the same target 2 times, and ignore the bottom damage.  As a limitation of the basic API and default template for attack and damage it only shows crit on the first target. The second target emulates crit by the bottom box on the right of the text will have an extra damage.  Ignore if only 1 target or no crit. Greenflameblade Macro @{selected|wtype}&{template:atkdmg} {{mod=[[@{selected|dexterity_mod}+2]]}} {{rname=@{selected|repeating_spell-cantrip_$0_spellname}}} {{r1=[[@{selected|d20}+@{selected|dexterity_mod}+2]]}} @{selected|rtype}cs>20 + (@{selected|dexterity_mod})]]}} &{{attack=1}} {{range=}} {{damage=[[1d10]]}} {{dmg1flag=1}} {{dmg2flag=1}} {{dmg1=[[1d4]]}} {{dmg1type=Slashing}} {{dmg2=[[1d8]]}} {{dmg2type=Fire}} {{crit1=[[1d4]]}} {{crit2=[[1d8]]}} {{desc=@{selected|token_name} slashes his whip at ***@{target|foe|token_name}*** and casts **@{selected|repeating_spell-cantrip_$0_spellname}**}} {{charname=@{selected|character_name}}} &{template:dmg}{{damage=[[1d8]]}} {{dmg1flag=1}} {{dmg1flag=1}} {{dmg2flag=1}} {{dmg1=[[1d8+(@{selected|spell_attack_bonus})]]}} {{dmg1type=Fire}} {{dmg2=[[1d8]]}} {{dmg2type=Fire}} {{crit1=[[1d8]]}} {{crit2=[[1d8]]}} {{desc=Flame leaps down the length of @{selected|character_name}'s whip and ignites ***@{target|foe|token_name}*** along with ***@{target|foe2|token_name}***}} level1 Macro is another spell book macro for quickly getting into your spell book without opening your character sheet.  It is expandable, and usuable for all classes that use spells.  Once again I use (!
%|#INSERTMACRONAMEHERE }) for casting custom spells, like Magic Missile. So once saved if you need to edit it, you will need that code to redue the macro. I know this can be a pain but it works for me. level1 Macro /w @{selected|character_name} &{template:default} {{name=Level 1 Spells}}{{=[@{selected|repeating_spell-1_$0_spellname}](!
%|#MagicMissileST }) [@{selected|repeating_spell-1_$1_spellname}](!
%|#MagicMissileMT }) [@{selected|repeating_spell-1_$2_spellname}](~selected|repeating_spell-1_$2_spell) [@{selected|repeating_spell-1_$3_spellname}](~selected|repeating_spell-1_$3_spell)[@{selected|repeating_spell-1_$4_spellname}](~selected|repeating_spell-1_$4_spell) [@{selected|repeating_spell-1_$5_spellname}](~selected|repeating_spell-1_$5_spell)[@{selected|repeating_spell-1_$6_spellname}](~selected|repeating_spell-1_$6_spell) [@{selected|repeating_spell-1_$7_spellname}](~selected|repeating_spell-1_$7_spell)}} Magic Missile Macros All of my magic missile macros are targeting.  ST = single target, MT = Multi Target.  Once again you must have your token selected before casting them.  Then on ST click 1 target, and on MT click 3 targets. You can always click the same target more than once if you want. The Names of the macros must be identical to what I have if you want them to work with my level1 spellbook macro.   MagicMissileST &{template:dmg} {{damage=}} {{rname=Magic Missile}}{{dmg1flag=1}} {{dmg1=[[3d4+3]]}} {{dmg1type=Force}} {{dmg2=}} {{dmg2type=Fire}} {{crit1=[[1d8]]}} {{crit2=[[1d8]]}} {{desc=@{selected|character_name} launches a bolt of Magic Missile at ***@{target|foe|token_name}***}} {{charname=@{selected|character_name}}} MagicMissileMT &{template:dmg} {{damage=}} {{rname=Magic Missile}}{{dmg1flag=1}} {{dmg1=[[1d4+1]]}} {{dmg1type=Force}} {{dmg2=}} {{dmg2type=Fire}} {{crit1=[[1d8]]}} {{crit2=[[1d8]]}} {{desc=@{selected|character_name} launches a bolt of Magic Missile at ***@{target|foe|token_name}***}} {{charname=@{selected|character_name}}} &{template:dmg} {{damage=}} {{rname=Magic Missile}}{{dmg1flag=1}} {{dmg1=[[1d4+1]]}} {{dmg1type=Force}} {{dmg2=}} {{dmg2type=Fire}} {{crit1=[[1d8]]}} {{crit2=[[1d8]]}} {{desc=@{selected|character_name} launches a bolt of Magic Missile at ***@{target|foe2|token_name}***}} {{charname=@{selected|character_name}}} &{template:dmg} {{damage=}} {{rname=Magic Missile}}{{dmg1flag=1}} {{dmg1=[[1d4+1]]}} {{dmg1type=Force}} {{dmg2=}} {{dmg2type=Fire}} {{crit1=[[1d8]]}} {{crit2=[[1d8]]}} {{desc=@{selected|character_name} launches a bolt of Magic Missile at ***@{target|foe3|token_name}***}} {{charname=@{selected|character_name}}} Level 2 Spell Book Macro This macro does not have anything special in it. just copy and paste it and it should work.  It is expandable as needed.  I will do a short tutorial on how to expand these macros below.  If you have any questions feel free to post below and I will try to answer them. level2 /w @{selected|character_name} &{template:default} {{name=Level 2 Spells}}{{=[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell) [@{selected|repeating_spell-2_$1_spellname}](~selected|repeating_spell-2_$1_spell) [@{selected|repeating_spell-2_$2_spellname}](~selected|repeating_spell-2_$2_spell) [@{selected|repeating_spell-2_$3_spellname}](~selected|repeating_spell-2_$3_spell)[@{selected|repeating_spell-2_$4_spellname}](~selected|repeating_spell-2_$4_spell) [@{selected|repeating_spell-2_$5_spellname}](~selected|repeating_spell-2_$5_spell)}} Spell Book Tutorial: Lets break down the macro. The first part just wispers it to you. No reason to spam the entire channel with you spell book. /w @{selected|character_name} the /w = Whisper. the @{selected|character_name} is the token that is currently selected. Next we have:   &{template:default} This is the type of template we are using. This is what gives it its formatting. Next is  {{name=Level 2 Spells}} That is the title of table.  It will show in the purple box that it makes. Now for the meat of the macro: {=[@{selected|repeating_spell-2_$0_spellname}] This is the name of the box. Thats it. It points to the selected tokens character, pulls up there spell book, and looks at spell 0 (first spell). It uses that name for the box.  Lets break this down a bit more.  [@{selected|repeating_spell-2 is telling us to go to the selected tokens spell book, level 2. Thats the repeating_spell-2.  Level 2 spells. the second part _$0_ is showing us which spell.  So in this case its the first spell. Then the spellname is just that, name of the spell.   (~selected|repeating_spell-2_$0_spell) This part of the code is telling the box when clicked to cast the selected tokens spell in there spell book at spell 0 (first spell).  Lets break this one down also.  (~selected| is the token that is selected. repeating_spell-2 is the level 2 spells, _$0_ is the spell in the list, this one is first spell. and _spell is the spell its going to cast. So to add to this we need to parts. The name of the box, {=[@{selected|repeating_spell-2_$0_spellname}] and the spell to cast. (~selected|repeating_spell-2_$0_spell) Change the $0 to a $1 and it will name and cast the second spell on your spell book.  So if we change the $0 to a $4 it will cast the 5th spell in the list.  If there is not a spell there it will cause an error.  Hope this helps. 
You forgot to list which of the 4 Sheet types you are using. Additionally I should point out that the Repeating Spell List is usually not going to be the same either. It is for this exact reason why I have instead opted for using the Abilities section of the Character Sheet in order to build the Spells. Also, you can set up a Pointer to the Spell so that you can simply call (for example) @{Green-Flame-Blade} and it will roll for Green-Flame-Blade. The portion you touched on in the beginning is known as HTML Replacement, or Parser Sidestepping (as that is the intended use). ! = Do not show the Line in Chat 
 = Line Return This goes on throughout the code, and is even useful in Handouts when you want to make it so you have an automated roll, for example;  Potion of Healing "Link": !
/roll 2d4+2 I have compiled a list of useful things (it might not be a complete list, but it should be comprehensive) of HTML Parser Sidestepping references in my GitHub . You are free to browse through it, I should be uploading my Cantrips to it within the next few weeks, still crawling my way through the Lv 1 Spells as well. I need to do (yet another) overhaul of the general formatting of it all, this time should be more permanent, however I should point out that I am using the 5e OGL Sheet for my Campaign, and, as such; I am making use of the Spell Template which is currently exclusive to it. It's capable of conversion into the &{template: default} but it would take a lot of work, as a lot of stuff would need to be changed around.