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

Kids on Brooms Stat Drop Down Macro Help

Hey all, Long time macro user, first time macro writer.  Normally I use other's pre-made macros for D&D e5, but I'm running a campaign for Kids on Brooms and would like to have a macro to roll my NPCs stats when their token is selected.  To save time from switching between character sheets.  Here's what I've written: &{template:kobrooms} {{name=StatCheck} {{character_name=@{selected|token_name}}} {{ ?{Select Stat|Charm,%{selected|charm}|Grit,%{selected|grit}Flight,%{selected|flight}|Brains,%{selected|brains}|Fight,%{selected|fight} } }} The drop down is popping up, but has "Charm,&{template:kobrooms" written in and not a drop down of options. It does proceed to the next selection correctly, to select a bonus option: stat, magic, none, and the next one to write in any additional bonuses or penalties. The output is a correctly formatted and shows rolls for grit, flight, brains and fight, no charm.  And the intended behavior would be to roll only 1 stat based upon the first selection. What have I done wrong here?  Is it a nesting issue?  Thanks for all the help!
This is a nesting issue because of the Roll20 Order of Operations . The contents  of the 'charm' attribute contain the full roll template (starting with &{template:kobrooms}) and that is being put into the query, because attributes are resolved before queries, and there are characters (comma, vertical pipe, or right brace) in the 'charm' attribute that are breaking your query.  Your query becomes this: ?{Select Stat|Charm,&{template:kobrooms} Because there is a right brace, Roll20 closes the query. For those reasons a Chat Menu  is usually the easier option for doing something like this.
1738185537
timmaugh
Forum Champion
API Scripter
Hey, Christina... What you likely have happening is that your ability references (like %{selected|charm} ) contains query-breaking characters (a comma, a pipe, or a right-brace NOT attached to an attribute or ability reference). Since abilities expand before queries are processed , all of the text from ALL of those abilities enters the verbiage of the query. When the query is processed, each of those control characters will tell the parser to do something. So it's likely that the right-brace of the &{template:kobrooms} syntax in the charm ability on the character is effectively ending the query (for the purposes of the parsing). This might be a good case for a  Chat Menu . &{template:default} {{name=KOB Actions}} {{ [Charm](~@{selected|character_name}|charm) [Grit](~@{selected|character_name}|grit) [Flight](~@{selected|character_name}|flight) [Brains](~@{selected|character_name}|brains) [Fight](~@{selected|character_name}|fight) }}
1738185570
timmaugh
Forum Champion
API Scripter
Ninja'd!
The issue here is, the ability is expanded out before the query is resolved, so by the time the query runs, it'll encounter a closing brace at &{template:kobrooms}, and end the query there. What is the full content of the abilities called? It sounds like you have a call for a template inside a template, which wouldn't work. Generally, it's best to avoid calling full macros in queries, because of how much trouble it is to work around the problem characters (",", "|" and "}"), instead using  chat menus where full macros are needed to be selected.  EDIT: double ninja'd!
Hey, thanks everyone!  I don't know why I didn't consider going for a Chat Menu option.  I appreciate you all.  Timmaugh, your macro worked perfectly!