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

Cool Drop Down Menus In Macros Trick

1440334691
Tom
Pro
Sheet Author
I hadn't even been aware this feature had gone live until this weekend.  Holy crap, I'm reeling from the possibilities.  So far, the only use of it I've seen is with Fantasy Age, where you can call up your Ability and Focus bonus right there in the macro.  Nice.  But how far are other people pushing it? See, I'm wondering if you couldn't package up stances or attack style modifiers.  Take Savage Worlds for example.  In your melee attack macro, could you include a drop down for things like Wild Attack or Total Defense that would then apply the necessary modifiers to your action?  Maybe even across your character sheet for your turn with a little API help?  I've no idea, but it intrigues the hell out of me.  Of course, unless there is a way to "hide" text within the drop down, this sort of thing could get really messy, really quick. So before I go off after those damned windmills again, what cool things HAVE people been doing with them?
For D&D 5e... 1. Make an attribute called AtkRoll 2. Copy/paste this into that attribute: ?{Attack|Standard, 1d20|w/Advantage, 2d20kh1|w/Disadvantage, 2d20kl1} 3. Use @{AtkRoll} any time you would use 1d20 instead. For example... /me slices with his longsword. Melee Attack [[ @{AtkRoll} + 2 [Prof. Bonus] + 3 [Str Bonus] ]] vs AC (@{target||token_name}) [[ 1d8 + 3 [Str Bonus] ]] slashing damage
1440348304
Silvyre
Forum Champion
Nesting roll queries. ?{Options|A,?{A|A1,?{A1|A1i|A1ii|A1iii}|A2,?{A2|A2i|A2ii|A2iii}|A3,?{A3|A3i|A3ii|A3iii}}|B,?{B|B1,?{B1|B1i|B1ii|B1iii}|B2,?{B2|B2i|B2ii|B2iii}|B3,?{B3|B3i|B3ii|B3iii}}|C,?{C|C1,?{C1|C1i|C1ii|C1iii}|C2,?{C2|C2i|C2ii|C2iii}|C3,?{C3|C3i|C3ii|C3iii}}}
There was a General thread about this when they just came out, actually. <a href="https://app.roll20.net/forum/post/2215687/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/2215687/slug%7D</a>
1440378832

Edited 1440378914
Silvyre
Forum Champion
Safeguarding against nonchoices. ?{Options|Choose one:,&amp;#63;{Choose an option&amp;#124;Try again.&amp;#124;A&amp;#124;B&amp;#124;C&amp;#124;D&amp;#124;E&amp;#124;F&amp;#124;G&amp;#125;|A|B|C|D|E|F|G}
1440380603
Tom
Pro
Sheet Author
Silvyre said: Safeguarding against nonchoices. ?{Options|Choose one:,&#63;{Choose an option&#124;Try again.&#124;A&#124;B&#124;C&#124;D&#124;E&#124;F&#124;G&#125;|A|B|C|D|E|F|G} This is...Greek to me. &nbsp;What is it? &nbsp;Are you tapping into an API code or something?
1440385512

Edited 1440385894
Silvyre
Forum Champion
Roll queries currently end at the first closing brace the parser encounters. Commas and vertical lines—also being query syntax—will also always be treated as such by the parser, potentially causing unwanted behaviour when placed within the query to serve other purposes. By replacing these three troublesome characters (closing braces, commas and vertical lines) with their HTML entities (&amp;#125; &amp;#44; and &amp;#124; respectively), one can influence the parser's behaviour (e.g. to the effect of allowing roll queries to be nested within other roll queries).
1441002019

Edited 1441002186
vÍnce
Pro
Sheet Author
Silvyre said: Roll queries currently end at the first closing brace the parser encounters. Commas and vertical lines—also being query syntax—will also always be treated as such by the parser, potentially causing unwanted behaviour when placed within the query to serve other purposes. By replacing these three troublesome characters (closing braces, commas and vertical lines) with their HTML entities (} , and | respectively), one can influence the parser's behaviour (e.g. to the effect of allowing roll queries to be nested within other roll queries). Silvyre would you mind adding this to the wiki, perhaps even giving an example? &nbsp;Or I can do it with your permission. Using a variable with a Macro edit:&nbsp;PM sent
1441034212
Silvyre
Forum Champion
Done.
1441053814

Edited 1441058294
Tom said: Silvyre said: Safeguarding against nonchoices. ?{Options|Choose one:,?{Choose an option|Try again.|A|B|C|D|E|F|G}|A|B|C|D|E|F|G} This is...Greek to me. &nbsp;What is it? &nbsp;Are you tapping into an API code or something? He is not. It can trigger API commands, but that's not what it's doing. There are four ideas you need to understand before understand the above: 1) What a roll query is. At it's simplest there's a description here . ?{Query Question}. That will pop up a little window what has the query's question and a little blank test box you can enter stuff in. Whatever you entered will replace the query macro command there and any other time you just give the name of the query. For example if you had ?{Query Question|&lt;A long string of options here&gt;} and entered "The Answer"? "The Answer" would replace the query command any place just ?{Query Question} appeared elsewhere in the macro. 2) The simplest option for the query is just a one word or number entry. ?{Query Question|Default Value}. This will do the same as above, but automatically fill in "Default Value" in the little box so you only have to enter something new if you didn't want the default. 3) Instead of a text box, you can make the role query be a drop down menu. You do this by providing it pairs of information. What you want the the entry in the menu item to say, and what you what the menu item to actually equal. For example: ?{Numbers|One,1|2,two|3,3|four,four} &nbsp;This query would have the drop down menu items "One", "2", "3", and "4". When a given menu item was select the query would be replaced with the values "1","two","3", or "four" respectively. 4) It can get much more complicated, and you may have to start using HTML character codes. The default value or drop down menu items don't have to be plain text! They can be attribute looks up, other macros, or even other queries! (Though the last two get into using the HTML Codes). So ... in the above example the query is in three main parts. ?{&lt;Base query name&gt;|&lt;another nested query that has it's own set of options&gt;|&lt;A long list of options one after the other labled 'A', 'B', 'C', etc.&gt;} You just need to see the "Choose one:,?{Choose an option|Try again.|A|B|C|D|E|F|G}" part as just another option of the first basic query "?{Options|&lt;stuff here&gt;}" until your ready to figure out what "Choose an option" is.
Correct me if I'm wrong, but there's still no way to call another macro from within a drop down, right?
1441056442
Silvyre
Forum Champion
Epsilon R. said: Correct me if I'm wrong, but there's still no way to call another macro from within a drop down, right? You're not entirely wrong. Silvyre said: Sun said: Are they any way to call a macro from a dropdown menu? I can not get this to work: ?{Options|A, #ActionA|B, #ActionB} Yes and no. Macros nested within roll queries are fully expanded before the query is executed. This becomes an issue (" order of operations " problem) if your macros contain certain items or characters. However, with the careful implementation of HTML entities, it would be possible to nest each of your individual macros within a single roll query. The following could be used to determine whether or not your macro is able to be called from a Roll Query: ?{Name of Query|Label 1,#macro |...} i.e., if it works, great. If it doesn't you'd have to remove the disagreeable elements or use HTML entities.
1441056667

Edited 1441056820
Epsilon R. said: Correct me if I'm wrong, but there's still no way to call another macro from within a drop down, right? That's correct.&nbsp; The order of operations resolves all terms at the same time.&nbsp; Query'ing for a macro name would only return the plain text, rather than the macro code it references. The only way to use macros within a Drop-Down Roll Query is to repeat the content of the actual macro , inline. This gets ... complicated... when you're talking about macros that contain Templates or other Queries. Admitedly messy example: <a href="https://app.roll20.net/forum/post/2159164/post-you" rel="nofollow">https://app.roll20.net/forum/post/2159164/post-you</a>...