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

Can anyone fix this?

friends..... i have a macro (as token action) nested inside another.... for saving throw and skills checks...... this saves space in the token action bar ..... (contemplates normal, advantages and disadvantages rolls). I put the code as token action inside the character (journal), and then in the atributte & abilities (checking as token action). The problem comes when I want to choose to roll a normal roll (1 die), which is rolled 2. As configured only one value is chosen (randomly), but what I want is that when I choose the NORMAL option, only 1 die is rolled not 2.  Thx in advance. 

I am sure that some of the gods of this forum in macros will know how to fix this tiny defect. :)

I post the code:

Saving throws

&{template:simple}{{?{Roll Type?|Normal,normal|Advantage,advantage|Disadvantage,disadvantage}=1}}?{Saving Throw?|STR,{{rname=Strength Save}}{{mod=@{selected|strength_save_bonus}}} {{r1=[[1d20+@{selected|strength_save_bonus}]]}}{{r2=[[1d20+@{selected|strength_save_bonus}]]}}|DEX,{{rname=Dexterity Save}}{{mod=@{selected|dexterity_save_bonus}}} {{r1=[[1d20+@{selected|dexterity_save_bonus}]]}}{{r2=[[1d20+@{selected|dexterity_save_bonus}]]}}|CON,{{rname=Constitution Save}}{{mod=@{selected|constitution_save_bonus}}} {{r1=[[1d20+@{selected|constitution_save_bonus}]]}}{{r2=[[1d20+@{selected|constitution_save_bonus}]]}}|INT,{{rname=Intelligence Save}}{{mod=@{selected|intelligence_save_bonus}}} {{r1=[[1d20+@{selected|intelligence_save_bonus}]]}}{{r2=[[1d20+@{selected|intelligence_save_bonus}]]}}|WIS,{{rname=Wisdom Save}}{{mod=@{selected|wisdom_save_bonus}}} {{r1=[[1d20+@{selected|wisdom_save_bonus}]]}}{{r2=[[1d20+@{selected|wisdom_save_bonus}]]}}|CHA,{{rname=Charisma Save}}{{mod=@{selected|charisma_save_bonus}}} {{r1=[[1d20+@{selected|charisma_save_bonus}]]}}{{r2=[[1d20+@{selected|charisma_save_bonus}]]}}}{{charname=@{selected|character_name}}}


Skill checks

&{template:simple}{{?{Roll Type?|Normal,normal|Advantage,advantage|Disadvantage,disadvantage}=1}}?{Ability?|Acrobatics,{{rname=Acrobatics}}{{mod=@{selected|acrobatics_bonus}}} {{r1=[[1d20+@{selected|acrobatics_bonus}]]}}{{r2=[[1d20+@{selected|acrobatics_bonus}]]}}|Animal Handling,{{rname=Animal Handling}}{{mod=@{selected|animal_handling_bonus}}} {{r1=[[1d20+@{selected|animal_handling_bonus}]]}}{{r2=[[1d20+@{selected|animal_handling_bonus}]]}}|Arcana,{{rname=Arcana}}{{mod=@{selected|arcana_bonus}}} {{r1=[[1d20+@{selected|arcana_bonus}]]}}{{r2=[[1d20+@{selected|arcana_bonus}]]}}|Athletics,{{rname=Athletics}}{{mod=@{selected|athletics_bonus}}} {{r1=[[1d20+@{selected|athletics_bonus}]]}}{{r2=[[1d20+@{selected|athletics_bonus}]]}}|Deception,{{rname=Deception}}{{mod=@{selected|deception_bonus}}} {{r1=[[1d20+@{selected|deception_bonus}]]}}{{r2=[[1d20+@{selected|deception_bonus}]]}}|History,{{rname=History}}{{mod=@{selected|History_bonus}}} {{r1=[[1d20+@{selected|History_bonus}]]}}{{r2=[[1d20+@{selected|History_bonus}]]}}|Insight,{{rname=Insight}}{{mod=@{selected|Insight_bonus}}} {{r1=[[1d20+@{selected|Insight_bonus}]]}}{{r2=[[1d20+@{selected|Insight_bonus}]]}}|Intimidation,{{rname=Intimidation}}{{mod=@{selected|Intimidation_bonus}}} {{r1=[[1d20+@{selected|Intimidation_bonus}]]}}{{r2=[[1d20+@{selected|Intimidation_bonus}]]}}|Investigation,{{rname=Investigation}}{{mod=@{selected|Investigation_bonus}}} {{r1=[[1d20+@{selected|Investigation_bonus}]]}}{{r2=[[1d20+@{selected|Investigation_bonus}]]}}|Medicine,{{rname=Medicine}}{{mod=@{selected|Medicine_bonus}}} {{r1=[[1d20+@{selected|Medicine_bonus}]]}}{{r2=[[1d20+@{selected|Medicine_bonus}]]}}|Nature,{{rname=Nature}}{{mod=@{selected|Nature_bonus}}} {{r1=[[1d20+@{selected|Nature_bonus}]]}}{{r2=[[1d20+@{selected|Nature_bonus}]]}}|Perception,{{rname=Perception}}{{mod=@{selected|Perception_bonus}}} {{r1=[[1d20+@{selected|Perception_bonus}]]}}{{r2=[[1d20+@{selected|Perception_bonus}]]}}|Performance,{{rname=Performance}}{{mod=@{selected|Performance_bonus}}} {{r1=[[1d20+@{selected|Performance_bonus}]]}}{{r2=[[1d20+@{selected|Performance_bonus}]]}}|Persuasion,{{rname=Persuasion}}{{mod=@{selected|Persuasion_bonus}}} {{r1=[[1d20+@{selected|Persuasion_bonus}]]}}{{r2=[[1d20+@{selected|Persuasion_bonus}]]}}|Religion,{{rname=Religion}}{{mod=@{selected|Religion_bonus}}} {{r1=[[1d20+@{selected|Religion_bonus}]]}}{{r2=[[1d20+@{selected|Religion_bonus}]]}}|Sleight of Hand,{{rname=Sleight of Hand}}{{mod=@{selected|sleight_of_hand_bonus}}} {{r1=[[1d20+@{selected|sleight_of_hand_bonus}]]}}{{r2=[[1d20+@{selected|sleight_of_hand_bonus}]]}}|Stealth,{{rname=Stealth}}{{mod=@{selected|Stealth_bonus}}} {{r1=[[1d20+@{selected|Stealth_bonus}]]}}{{r2=[[1d20+@{selected|Stealth_bonus}]]}}|Survival,{{rname=Survival}}{{mod=@{selected|Survival_bonus}}} {{r1=[[1d20+@{selected|Survival_bonus}]]}}{{r2=[[1d20+@{selected|Survival_bonus}]]}}}{{charname=@{selected|character_name}}}




October 30 (4 years ago)
David M.
Pro
API Scripter

I try not to get into troubleshooting nested macros, for fear of my punching my hand through my monitor in a fit of rage.

Are you using the 5E by Roll20 sheet? If so, the following macros (derived from an api scriptlet written by Oosh) are awesome! The first is for skills & ability checks, and the second is for saves. It uses the default rolling behavior dictated by the individual sheet's settings (always adv, adv toggle, query adv, etc - sounds like you would want "Query Advantage"). The best part is it will also dynamically incorporate any global modifiers, like Bless or Guidance spells, jack of all trades, etc! The only thing currently missing is the edge case of Reliable Talent for high level rogues.

Skills & ability checks (ability checks are at the bottom of the drop-down)

@{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}

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}

Yep, i use the roll20 5e template. I know that nested macros are a hell, but i want to fix this little problem.... :)   is almost like something personal hahaha

October 30 (4 years ago)
David M.
Pro
API Scripter

Hmm, I just tested them out with several iterations/combinations and they seem to be working properly? Unless I'm not understanding the problem.

Works correctly in some ways, but when you choose to roll 1 die (normal roll), it rolls on screen 2. That's the problem. One is chosen at random, but I want only 1 die to be rolled with the normal option and only 1 die should be rolled on the screen. I can't find the formula to remove that extra die from the normal option. 

October 30 (4 years ago)
David M.
Pro
API Scripter

Are you talking 3d dice, perhaps? It shows up as one die roll in chat for me when normal is selected. 

October 31 (4 years ago)
Oosh
Sheet Author
API Scripter

You're forcing a {{r2}} in your macro, which is why you're getting 2 rolls. The second one isn't displayed in chat due to the {{normal=1}} property in the template, but it's still getting rolled.

The best way around that is to use the @{rtype} Attribute from the sheet, that'll change the second roll to 0d20 for a normal roll. @{rtype} contains the start of {{r2}} as well, and you need to keep it outside of your other Query. Like in the ones David posted above.

exactly, 3d dice on the screen... I meant that :)