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

[5e OGL Template] Advanced(ish) Macro Help

1485361276
Layton
API Scripter
I have just discovered that this code doesn't work: ?{Brawler Feat?|No, + {[[@{selected|strength_mod}]][STR], 0}kh1|Yes, + {[[@{selected|strength_mod}]][STR], [[@{selected|dexterity_mod}]][DEX], 0}kh1} I understand where the problem is, but are there any alternatives that will give the same output? Been having related issues for a while now, though this one I cannot find a work-around for. All help appreciated <3
1485361813

Edited 1485361853
The Aaron
Pro
API Scripter
Try replacing the | in @{selected|strength_mod}, etc with | like this: ?{Brawler Feat?|No, + {[[@{selected|strength_mod}]][STR], 0}kh1|Yes, + {[[@{selected|strength_mod}]][STR], [[@{selected|dexterity_mod}]][DEX], 0}kh1} Note that you will likely need to type those in as otherwise they will get changed when your browser pastes them.  Also, if you ever edit the macro, you'll have to type them again.
1485362056
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is an example of an  advanced roll query . Due to the  order of operations* , which is attributes/abilities expanded (up to 99 levels deep) -> roll queries (up to 99 levels deep) -> Inline Rolls -> slash command rolls -> message sent to chat/API handler, you will need to html replace all end curly braces (}), commas ,), and bars (|) that are not part of the query itself or part of an attribute or ability call (as these are replaced with the content of that attribute or ability before the query is evaluated). *Note there is an error in the wiki's description of order of operations which states that attributes/abilities are expanded followed by roll queries and then all of those are recursed through up to 99 times. This is incorrect as the actual behavior is as I described above.
1485362513
Layton
API Scripter
The Aaron said: Try replacing the | in @{selected|strength_mod}, etc with | like this: ?{Brawler Feat?|No, + {[[@{selected|strength_mod}]][STR], 0}kh1|Yes, + {[[@{selected|strength_mod}]][STR], [[@{selected|dexterity_mod}]][DEX], 0}kh1} Scott C. said: This is an example of an  advanced roll query . Due to the  order of operations* , which is attributes/abilities expanded (up to 99 levels deep) -> roll queries (up to 99 levels deep) -> Inline Rolls -> slash command rolls -> message sent to chat/API handler, you will need to html replace all end curly braces (}), commas ,), and bars (|) that are not part of the query itself or part of an attribute or ability call. Thanks guys, gonna try Aaron's suggestion first as it takes far less work, and go for Scott's after that, then report back here.
1485362719
The Aaron
Pro
API Scripter
Well.. Scott has more experience than me with those, so he's likely got the right of it. =D
1485363154
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yeah, had to go get some experiments running so I didn't have time to edit my reply when I saw Aaron had already posted. Unfortunately the only thing replacing the bar in the attribute calls will do is cause you to get a chat error something like "no attribute found..." Along with the query not working.
1485363432

Edited 1485364019
From my experience with the advanced queries, the | and } of attribute calls for example @{selected|strength_mod} do not need to be changed. However, the "," and "}" of the kh1s do need to be changed to &# 44; and &# 125; (minus spaces, because I have yet to figure out how to not let the forum convert it to the symbol), respectively ?{Brawler Feat?|No, + {[[@{selected|strength_mod}]][STR]&# 44; 0&# 125;kh1|Yes, + {[[@{selected|strength_mod}]][STR]&# 44; [[@{selected|dexterity_mod}]][DEX]&# 44; 0&# 125;kh1} EDIT: fixed the HTML equivalents to show with a space in the middle between &# and the number to avoid confusion.
1485363736

Edited 1485363768
Layton
API Scripter
Okay I'm pretty sure I'm an idiot. Moved onto Scott's suggestion and this is where I'm at: Uploaded as a picture to avoid the HTML code issues. Thing is, that still isn't working in the slightest.
1485364620
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Kyle G. said: (minus spaces, because I have yet to figure out how to not let the forum convert it to the symbol) You simply escape the html escape, so the } for a } becomes }, and of course I simply did a triple escape to display the double escape. The downside is that the forum parser unescapes everything once every time you save the post, so editing a post with lots of html escapes isn't very practical. Layton said: Okay I'm pretty sure I'm an idiot. Moved onto Scott's suggestion and this is where I'm at: Uploaded as a picture to avoid the HTML code issues. Thing is, that still isn't working in the slightest. You still have the bar in your attribute calls escaped along with the ending curly braces of your attribute calls escaped. The general rule is to never escape any characters that are part of an attribute or ability call due to the order of operations I explained above. Your macro should look like this: ?{Brawler Feat?|No, + {[[@{selected|strength_mod}]][STR], 0}kh1|Yes, + {[[@{selected|strength_mod}]][STR], [[@{selected|dexterity_mod}]][DEX], 0}kh1}
1485364724
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Edit to my previous post - this is the same thing that kyle posted, I just misread what he posted.
1485365394

Edited 1485365491
Layton
API Scripter
I am actually making solid progress now. Upon reading Kyle's comment I realised what you had already said, Scott.&nbsp; New problem, and this time I have no idea what the error is. {{?{Advantage?|None, normal=1|Advantage, advantage=1|Disadvantage, disadvantage=1}}} For some reason this doesn't work for defining the advantage. I'm using the 5e OGL atkdmg template:&nbsp; <a href="https://wiki.roll20.net/5e_OGL_Roll_Templates" rel="nofollow">https://wiki.roll20.net/5e_OGL_Roll_Templates</a> FIXED By removing the space after each comma the problem stopped. Sorry bout that one :P
Layton said: I am actually making solid progress now. Upon reading Kyle's comment I realised what you had already said, Scott.&nbsp; New problem, and this time I have no idea what the error is. {{?{Advantage?|None, normal=1|Advantage, advantage=1|Disadvantage, disadvantage=1}}} For some reason this doesn't work for defining the advantage. I'm using the 5e OGL atkdmg template:&nbsp; <a href="https://wiki.roll20.net/5e_OGL_Roll_Templates" rel="nofollow">https://wiki.roll20.net/5e_OGL_Roll_Templates</a> FIXED By removing the space after each comma the problem stopped. Sorry bout that one :P To make it simpler and reduce unnecessary code you could move the "=1" to the outside of the query since each option has that in the value. {{?{Advantage?|None,normal|Advantage,advantage|Disadvantage,disadvantage}=1}}
1485366116
Layton
API Scripter
I'm super confused now. Is there a limit to inline rolls? &{template:atkdmg} {{mod=?{Brawler Feat?|No,+[[{@{selected|strength_mod}[STR]&#44; 0&#125;kh1]]|Yes,+[[{@{selected|strength_mod}[STR]&#44; @{selected|dexterity_mod}[DEX]&#44; 0&#125;kh1]]&#125;}}} {{rname=Unarmed Attack}} {{r1=[[1d20@{selected|halflingluck}cs&gt;20 ?{Brawler Feat?}]]}} {{?{Advantage?|None,normal=1|Advantage,advantage=1|Disadvantage,disadvantage=1}}} {{r2=[[1d20@{selected|halflingluck}cs&gt;20 ?{Brawler Feat?}]]}} {{attack=0}} {{range=5 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1 ?{Brawler Feat?}]]}} {{dmg1type=bludgeoning}} {{damage=1}} {{dmg2flag=}} {{dmg2=}} {{dmg2type=}} {{crit1=1 + ?{Brawler Feat?} @{selected|brawler}}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=@{selected|token_name} makes an unarmed attack.}} ammo=ammo {{charname=@{selected|token_name}}}
1485366118
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, the predefined roll template fields are very picky about what you type in for the name of the field.
1485366424
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Layton said: I'm super confused now. Is there a limit to inline rolls? &{template:atkdmg} {{mod=?{Brawler Feat?|No,+[[{@{selected|strength_mod}[STR], 0}kh1]]|Yes,+[[{@{selected|strength_mod}[STR], @{selected|dexterity_mod}[DEX], 0}kh1]]}}}} {{rname=Unarmed Attack}} {{r1=[[1d20@{selected|halflingluck}cs&gt;20 ?{Brawler Feat?}]]}} {{?{Advantage?|None,normal=1|Advantage,advantage=1|Disadvantage,disadvantage=1}}} {{r2=[[1d20@{selected|halflingluck}cs&gt;20 ?{Brawler Feat?}]]}} {{attack=0}} {{range=5 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1 ?{Brawler Feat?}]]}} {{dmg1type=bludgeoning}} {{damage=1}} {{dmg2flag=}} {{dmg2=}} {{dmg2type=}} {{crit1=1 + ?{Brawler Feat?} @{selected|brawler}}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=@{selected|token_name} makes an unarmed attack.}} ammo=ammo {{charname=@{selected|token_name}}} There is, but you shouldn't be coming anywhere near it as it is something like 999 rolls or something sillily(sic) high like that. Not sure what's going on there.
1485366548
Layton
API Scripter
Scott C. said: Layton said: I'm super confused now. Is there a limit to inline rolls? &{template:atkdmg} {{mod=?{Brawler Feat?|No,+[[{@{selected|strength_mod}[STR], 0}kh1]]|Yes,+[[{@{selected|strength_mod}[STR], @{selected|dexterity_mod}[DEX], 0}kh1]]}}}} {{rname=Unarmed Attack}} {{r1=[[1d20@{selected|halflingluck}cs&gt;20 ?{Brawler Feat?}]]}} {{?{Advantage?|None,normal=1|Advantage,advantage=1|Disadvantage,disadvantage=1}}} {{r2=[[1d20@{selected|halflingluck}cs&gt;20 ?{Brawler Feat?}]]}} {{attack=0}} {{range=5 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1 ?{Brawler Feat?}]]}} {{dmg1type=bludgeoning}} {{damage=1}} {{dmg2flag=}} {{dmg2=}} {{dmg2type=}} {{crit1=1 + ?{Brawler Feat?} @{selected|brawler}}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=@{selected|token_name} makes an unarmed attack.}} ammo=ammo {{charname=@{selected|token_name}}} There is, but you shouldn't be coming anywhere near it as it is something like 999 rolls or something sillily(sic) high like that. Not sure what's going on there. This has happened to me repeatedly throughout my experience with roll20 macros and each time I have to limit my inline rolls. If you could find me any way of fixing this, or even direct me to a place where I could find the knowledge myself, you'd have helped me a ton.
This has happened to me repeatedly throughout my experience with roll20 macros and each time I have to limit my inline rolls. If you could find me any way of fixing this, or even direct me to a place where I could find the knowledge myself, you'd have helped me a ton. So I found a fix for you, but I'm not entirely sure of the cause. I think it may be do to extra spaces, the templates are very picky about spacing as you have already figured out. Also, there is no need to keep the template variables that are {{name=}}. They take up space and add to the confusion on trying to figure out problems. &{template:atkdmg} {{mod=?{Brawler Feat?|No,[[{@{selected|strength_mod}&amp;#44;0&amp;#125;kh1]][STR]|Yes,[[{[[@{selected|strength_mod}]][STR]&amp;#44;[[@{selected|dexterity_mod}]][DEX]&amp;#44;0&amp;#125;kh1]][Brawler]}}} {{rname=Unarmed Attack}} {{r1=[[1d20@{selected|halflingluck}cs&gt;20+?{Brawler Feat?}]]}} {{?{Advantage?|None,normal|Advantage,advantage|Disadvantage,disadvantage}=1}} {{r2=[[1d20@{selected|halflingluck}cs&gt;20+?{Brawler Feat?}]]}} {{attack=0}} {{range=5 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1+?{Brawler Feat?}]]}} {{dmg1type=bludgeoning}} {{crit1=1+?{Brawler Feat?}+@{selected|brawler}}} {{desc=@{selected|token_name} makes an unarmed attack.}} {{charname=@{selected|token_name}}} I am a bit confused as to how you are doing this brawler feat because RAW it says that you are proficient with improvised weapons, your unarmed strikes become d4+STR(or DEX if monk) and can grapple as a bonus action after you attack with unarmed strike. With this being said, I'm confused why you are not adding @{selected|pb} in the r1/r2 when the user selected yes to the brawler feat. I'm also confused as to why you are adding the brawler feat modifier (STR/DEX) for critical hits (RAW only dice are doubled not modifiers).
1485369211
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, yeah, roll queries can interact oddly with inline rolls. It's always best to put a space between the ending brackets of an inline roll and the comma, bar, or end curly brace of the roll query. I would move the "[STR]" roll tag for the no option back inside the keep highest function though, but other than that, Kyle's fix works perfectly. I don't know 5e that well (and it doesn't have a nice comprehensive srd like Pathfinder) so I can't really comment on the correctness of using this feat.
1485376624

Edited 1485377564
Layton
API Scripter
Kyle G. said: So I found a fix for you.. Lawdy thank you, this has been eating away at me. Kyle G. said: I am a bit confused as to how you are doing this brawler feat because RAW it says that you are proficient with improvised weapons, your unarmed strikes become d4+STR(or DEX if monk) and can grapple as a bonus action after you attack with unarmed strike. With this being said, I'm confused why you are not adding @{selected|pb} in the r1/r2 when the user selected yes to the brawler feat. I'm also confused as to why you are adding the brawler feat modifier (STR/DEX) for critical hits (RAW only dice are doubled not modifiers). All good points &gt;_&lt; that's all me just focusing too much on the macro and not enough on the rules. Cheers &lt;3 Final: [edited to fix] &{template:atkdmg} {{mod=?{Brawler Feat?|No,[[{[[@{selected|strength_mod}]]&amp;#44;0&amp;#125;kh1]][STR]|Yes,[[@{selected|pb}+{@{selected|strength_mod}[STR]&amp;#44;@{selected|dexterity_mod}[DEX]&amp;#44;0&amp;#125;kh1]][BRAWL]}}} {{rname=Unarmed Attack}} {{r1=[[1d20@{selected|halflingluck}cs&gt;20+?{Brawler Feat?}]]}} {{?{Advantage?|None,normal|Advantage,advantage|Disadvantage,disadvantage}=1}} {{r2=[[1d20@{selected|halflingluck}cs&gt;20+?{Brawler Feat?}]]}} {{attack=0}} {{range=5 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1+?{Brawler Feat?}@{selected|brawler}]]}} {{dmg1type=bludgeoning}} {{crit1=1@{selected|brawler}}} {{desc=@{selected|token_name} makes an unarmed attack.}} {{charname=@{selected|token_name}}}