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 .
×

Help with Macro

Trying to create a skills drop down macro.. There are tons of examples here, looking far too complex for me.. I believe I am having some html entities issues. The character sheet is D&D 5E by Roll20 that we are using in the Master's Vault I am inserting this text into the macro editor, with Token Action checked. &{template:simple} {{always=1}} ?{Skill| Acrobatics, /at{selected|acrobatics_roll}| Animal Handling, animal_handling_roll| Arcana, arcana_roll| Athletics, athletics_roll| Deception, deception_roll| History, history_roll| Insight, insight_roll| Intimidation, intimidation_roll| Investigation, investigation_roll| Medicine, medicine_roll| Nature, nature_roll| Perception, perception_roll| Performance, performance_roll| Persuasion, persuasion_roll| Religion, religion_roll| Sleight of Hand, sleight_of_hand_roll| Stealth, stealth_roll| Survival, survival_roll } If I use an unaltered line of Acrobatics, @{selected|acrobatics_roll}, the resulting Skills pop up will be a text field with "Acrobatics, &{template:simple" in it. Clicking submit does make an acrobatics roll, but it spits out the rest of the macro below that line. If I change the @ to /at, the Skills pop up contains a drop down list with two items, Acrobatics and acrobatics_roll. Clicking submit spits out an empty template, and the rest of the contents of the macro, with no roll made. If I replace the last } with  } the Skills pop up contains a drop down list with three items, Acrobatics, acrobatics_roll} and Animal Handling. Clicking submit does the same as the last change. So now I replace the | with  | and the Skills pop up displays the label for each skill line... Awesome! But wait, clicking submit just outputs a lonely empty simple template. I feel I am so close, but I am boggled..  
1605457395
David M.
Pro
API Scripter
Try this one (credit to Oosh):  Skills and base ability checks query macro (note works best if used as an "ability" macro, rather than a collections macro, as the html replacements will get lost in a collections macro if you ever re-open it. Will stay as written if an ability.) @{selected|wtype}&{template:simple} @{selected|rtype}?{Ability|Acrobatics, +@{selected|Acrobatics_bonus}@{selected|pbd_safe}[Acrobatics]]]}} {{rname=Acrobatics}} {{mod=@{selected|Acrobatics_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Acrobatics_bonus}@{selected|pbd_safe}[Acrobatics]]]|Animal Handling, +@{selected|Animal_Handling_bonus}@{selected|pbd_safe}[Animal]]]}} {{rname=Animal Handling}} {{mod=@{selected|Animal_Handling_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Animal_Handling_bonus}@{selected|pbd_safe}[Animal]]]|Arcana, +@{selected|Arcana_bonus}@{selected|pbd_safe}[Arcana]]]}} {{rname=Arcana}} {{mod=@{selected|Arcana_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Arcana_bonus}@{selected|pbd_safe}[Arcana]]]|Athletics, +@{selected|Athletics_bonus}@{selected|pbd_safe}[Athletics]]]}} {{rname=Athletics}} {{mod=@{selected|Athletics_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Athletics_bonus}@{selected|pbd_safe}[Athletics]]]|Deception, +@{selected|Deception_bonus}@{selected|pbd_safe}[Deception]]]}} {{rname=Deception}} {{mod=@{selected|Deception_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Deception_bonus}@{selected|pbd_safe}[Deception]]]|History, +@{selected|History_bonus}@{selected|pbd_safe}[History]]]}} {{rname=History}} {{mod=@{selected|History_bonus}}} {{r1=[[ @{selected|d20} + @{selected|History_bonus}@{selected|pbd_safe}[History]]]|Insight, +@{selected|Insight_bonus}@{selected|pbd_safe}[Insight]]]}} {{rname=Insight}} {{mod=@{selected|Insight_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Insight_bonus}@{selected|pbd_safe}[Insight]]]|Intimidation, +@{selected|Intimidation_bonus}@{selected|pbd_safe}[Intimidation]]]}} {{rname=Intimidation}} {{mod=@{selected|Intimidation_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Intimidation_bonus}@{selected|pbd_safe}[Intimidation]]]|Investigation, +@{selected|Investigation_bonus}@{selected|pbd_safe}[Investigation]]]}} {{rname=Investigation}} {{mod=@{selected|Investigation_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Investigation_bonus}@{selected|pbd_safe}[Investigation]]]|Medicine, +@{selected|Medicine_bonus}@{selected|pbd_safe}[Medicine]]]}} {{rname=Medicine}} {{mod=@{selected|Medicine_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Medicine_bonus}@{selected|pbd_safe}[Medicine]]]|Nature, +@{selected|Nature_bonus}@{selected|pbd_safe}[Nature]]]}} {{rname=Nature}} {{mod=@{selected|Nature_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Nature_bonus}@{selected|pbd_safe}[Nature]]]|Perception, +@{selected|Perception_bonus}@{selected|pbd_safe}[Perception]]]}} {{rname=Perception}} {{mod=@{selected|Perception_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Perception_bonus}@{selected|pbd_safe}[Perception]]]|Performance, +@{selected|Performance_bonus}@{selected|pbd_safe}[Performance]]]}} {{rname=Performance}} {{mod=@{selected|Performance_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Performance_bonus}@{selected|pbd_safe}[Performance]]]|Persuasion, +@{selected|Persuasion_bonus}@{selected|pbd_safe}[Persuasion]]]}} {{rname=Persuasion}} {{mod=@{selected|Persuasion_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Persuasion_bonus}@{selected|pbd_safe}[Persuasion]]]|Religion, +@{selected|Religion_bonus}@{selected|pbd_safe}[Religion]]]}} {{rname=Religion}} {{mod=@{selected|Religion_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Religion_bonus}@{selected|pbd_safe}[Religion]]]|Sleight Of Hand, +@{selected|Sleight_Of_Hand_bonus}@{selected|pbd_safe}[Sleight]]]}} {{rname=Sleight Of Hand}} {{mod=@{selected|Sleight_Of_Hand_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Sleight_Of_Hand_bonus}@{selected|pbd_safe}[Sleight]]]|Stealth, +@{selected|Stealth_bonus}@{selected|pbd_safe}[Stealth]]]}} {{rname=Stealth}} {{mod=@{selected|Stealth_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Stealth_bonus}@{selected|pbd_safe}[Stealth]]]|Survival, +@{selected|Survival_bonus}@{selected|pbd_safe}[Survival]]]}} {{rname=Survival}} {{mod=@{selected|Survival_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Survival_bonus}@{selected|pbd_safe}[Survival]]]|Strength, +@{selected|Strength_mod}@{selected|jack_attr}[STR]]]}} {{rname=Strength}} {{mod=@{selected|Strength_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Strength_mod}@{selected|jack_attr}[STR]]]|Dexterity, +@{selected|Dexterity_mod}@{selected|jack_attr}[DEX]]]}} {{rname=Dexterity}} {{mod=@{selected|Dexterity_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Dexterity_mod}@{selected|jack_attr}[DEX]]]|Constitution, +@{selected|Constitution_mod}@{selected|jack_attr}[CON]]]}} {{rname=Constitution}} {{mod=@{selected|Constitution_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Constitution_mod}@{selected|jack_attr}[CON]]]|Intelligence, +@{selected|Intelligence_mod}@{selected|jack_attr}[INT]]]}} {{rname=Intelligence}} {{mod=@{selected|Intelligence_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Intelligence_mod}@{selected|jack_attr}[INT]]]|Wisdom, +@{selected|Wisdom_mod}@{selected|jack_attr}[WIS]]]}} {{rname=Wisdom}} {{mod=@{selected|Wisdom_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Wisdom_mod}@{selected|jack_attr}[WIS]]]|Charisma, +@{selected|Charisma_mod}@{selected|jack_attr}[CHA]]]}} {{rname=Charisma}} {{mod=@{selected|Charisma_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Charisma_mod}@{selected|jack_attr}[CHA]]]}}} {{global=@{selected|global_skill_mod}}} @{selected|charname_output} Similar one for saves @{selected|wtype}&{template:simple} @{selected|rtype}?{Saving Throw|Strength, +@{selected|Strength_save_bonus}@{selected|pbd_safe}[STR SAVE]]]}} {{rname=Strength Save}&#125 {{mod=@{selected|Strength_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|Strength_save_bonus}@{selected|pbd_safe}[STR SAVE]]]|Dexterity, +@{selected|Dexterity_save_bonus}@{selected|pbd_safe}[DEX SAVE]]]}} {{rname=Dexterity Save}&#125 {{mod=@{selected|Dexterity_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|Dexterity_save_bonus}@{selected|pbd_safe}[DEX SAVE]]]|Constitution, +@{selected|Constitution_save_bonus}@{selected|pbd_safe}[CON SAVE]]]}} {{rname=Constitution Save}&#125 {{mod=@{selected|Constitution_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|Constitution_save_bonus}@{selected|pbd_safe}[CON SAVE]]]|Intelligence, +@{selected|Intelligence_save_bonus}@{selected|pbd_safe}[INT SAVE]]]}} {{rname=Intelligence Save}&#125 {{mod=@{selected|Intelligence_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|Intelligence_save_bonus}@{selected|pbd_safe}[INT SAVE]]]|Wisdom, +@{selected|Wisdom_save_bonus}@{selected|pbd_safe}[WIS SAVE]]]}} {{rname=Wisdom Save}&#125 {{mod=@{selected|Wisdom_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|Wisdom_save_bonus}@{selected|pbd_safe}[WIS SAVE]]]|Charisma, +@{selected|Charisma_save_bonus}@{selected|pbd_safe}[CHA SAVE]]]}} {{rname=Charisma Save}&#125 {{mod=@{selected|Charisma_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|Charisma_save_bonus}@{selected|pbd_safe}[CHA SAVE]]]}}} {{global=@{selected|global_save_mod}}} @{selected|charname_output}
1605461660

Edited 1605462685
I would really like to understand what is happening with what I am working with, rather than just pasting that incredibly confusing amount of text into my ability macro. The above works, though its a huge amount of stuff that I don't understand why it works, and mine does not. The sheet already contains the entire roll in the acrobatics_roll attribute (and for every other skill) so I would like to leverage that. Some questions about the above macro: Acrobatics, +@{selected|Acrobatics_bonus}@{selected|pbd_safe}[Acrobatics]]]}} In the above snip, why is there two extra ]] after [Acrobatics]. There was no opening [[ . Why is there two html } when there is no opening {{ {{rname=Acrobatics}} I can see there is two } here to close the opening {{, but why is there two {{ and not just a single { {{mod=@{selected|Acrobatics_bonus}}} Again I can see those two closing } {{r1=[[ @{selected|d20} + @{selected|Acrobatics_bonus}@{selected|pbd_safe}[Acrobatics]]] This is just before the | that ends the option. Why does the {{ not get closed? Charisma, +@{selected|Charisma_mod}@{selected|jack_attr}[CHA]]]}} {{rname=Charisma}} {{mod=@{selected|Charisma_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|Charisma_mod}@{selected|jack_attr}[CHA]]]}}} {{global=@ At the end of the macro, the Charisma line, I see those two extra }} missing from the rest of the r1 segments. Why is only the last one closed... Since I am trying to use the Attribute acrobatics_roll and it = @{wtype}&{template:simple} {{rname=^{acrobatics-u}}} {{mod=@{acrobatics_bonus}}} {{r1=[[@{d20}+-1[dexterity]@{pbd_safe}]]}} {{query=1}} {{advantage=1}} {{r2=[[@{d20}+-1[dexterity]@{pbd_safe}]]}} {{global=@{global_skill_mod}}} @{charname_output} is that creating the problem for me? like trying to insert that line inline with the macro, then causing havoc? was trying to keep the macro looking simple, by using those Attributes... Edit: actually I think this is causing all my problems, it can't nest that attribute in my macro because it has those characters that should be html entities... and also each and every attribute is inserting those  @{wtype}&{template:simple} and  {{global=@{global_skill_mod}}} @{charname_output} stuff
1605608381

Edited 1605608743
Oosh
Sheet Author
API Scripter
I'll try to answer a bunch of that at the same time. As this page explains ,  } | and , characters will all break a Query if they're not escaped. So we'll start with a simple Skill Check macro: ?{Skill Check| Acrobatics, &{template:default} {{name=Acrobatics}} {{Roll=[[1d20 + @{bob|acrobatics_bonus}]]}} | Perception, &{template:default} {{name=Perception}} {{Roll=[[1d20 + @{bob|perception_bonus}]]}} | Religion, &{template:default} {{name=Religion}} {{Roll=[[1d20 + @{bob|religion_bonus}]]}} } This macro won't work. The braces inside the Query are going to break it, so we need to escape all the braces that don't belong to an Attribute or Ability call. So we'd need to do this: ?{Skill Check| Acrobatics, &{template:default} {{name=Acrobatics}} {{Roll=[[1d20 + @{bob|acrobatics_bonus}]]}} | Perception, &{template:default} {{name=Perception}} {{Roll=[[1d20 + @{bob|perception_bonus}]]}} | Religion, &{template:default} {{name=Religion}} {{Roll=[[1d20 + @{bob|religion_bonus}]]}} } But a more efficient way to deal with it, is to take a bunch of that content out of Query altogether. If it's not specific to the option selected, it can go outside. Keep in mind that you can put {{template fields}} in any order you like, even the &{template:declaration}. So this macro is shorter and there's less HTML replacement to do: &{template:default} {{Roll=[[1d20 + ?{Skill Check| Acrobatics,@{bob|acrobatics_bonus}]]}} {{name=Acrobatics| Perception,@{bob|perception_bonus}]]}} {{name=Perception| Religion,@{bob|religion_bonus}]]}} {{name=Religion} }} This is only a very short example, but see how the Query goes right in the middle of the roll - that's pretty much what's happening on a much larger scale in the macro above that David posted. Even the closing braces }} for the name field go after the brace that closes the Query - that's 2 less characters to escape. So the first example is why your attempt isn't working. The sheet Attributes & Abilities all contain characters which will break your Query - you simply cannot use them in a drop-down. The final example is a microcosm of what's going on in the full 5e macro above - thought there's a bit more to worry about, like keeping the Advantage/Disadvantage Query clear of the Skill Query - you really don't want to tangle two Queries together if you can help it. The missing characters aren't really missing, they're just outside the Query, to reduce the repetition required inside. The Query is fully resolved before any math is done, so interrupting an inline roll is fine. Interrupting an Attribute or Ability is not fine, as they come first in Order of Operations (another issue your macro had). Hopefully some of that makes sense?
1605617564
David M.
Pro
API Scripter
Yay, Oosh! That's a much better answer than I was going to come up with :) And thank you so much for the scriptlet that generated the abilities above. I would never have even attempted to do all that manually, and it's the most complete solution I have seen.
1605622051
Oosh
Sheet Author
API Scripter
No problem! I'm still supposed to be getting around to finishing that off....