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

?{Choose |Op1 , X1 | Opt2 , X2} with template

How do i make this macro work? ?{Choose| Strength (@{selected|npc_str_save}), &{template:default}{{name=Strength Saving Throw}} {{attack=[[d20+@{selected|npc_str_save}]]}}| Dexterity (@{selected|npc_dex_save}), &{template:default}{{name=Dexterity Saving Throw}} {{attack=[[d20+@{selected|npc_dex_save}]]}}| Constitution (@{selected|npc_con_save}), &{template:default}{{name=Constitution Saving Throw}} {{attack=[[d20+@{selected|npc_con_save}]]}}| Intelligence (@{selected|npc_int_save}), &{template:default}{{name=Intelligence Saving Throw}} {{attack=[[d20+@{selected|npc_int_save}]]}}| Wisdom (@{selected|npc_wis_save}), &{template:default}{{name=Wisdom Saving Throw}} {{attack=[[d20+@{selected|npc_wis_save}]]}}| Charisma (@{selected|npc_cha_save}), &{template:default}{{name=Charisma Saving Throw}} {{attack=[[d20+@{selected|npc_cha_save}]]}}| }
or this: @{Ancient Blue Dragon|wtype}&{template:npc} @{Ancient Blue Dragon|npc_name_flag} {{rname=^{dexterity-save}}} {{mod=[[[[@{Ancient Blue Dragon|npc_dex_save}]][DEX SAVE]]]}} {{r1=[[@{Ancient Blue Dragon|d20}+[[@{Ancient Blue Dragon|npc_dex_save}]][DEX SAVE]]]}} @{Ancient Blue Dragon|rtype}+[[@{Ancient Blue Dragon|npc_dex_save}]][DEX SAVE]]]}} {{type=Save}} How do I add something complex as this in a ?{choose|...}
1510470147

Edited 1510470287
Vanakoji
KS Backer
?{Choose|Strength (@{selected|npc_str_save}),&{template:default} {{name=Strength Saving Throw}} {{attack=[[d20+ @{selected|npc_dex_save}]]}}|y,2} I believe is what you want, here just strength is done but if you kept going with the same format others should work as well.
why does it requerie to use "&amp ;" or "&#125 ;" to work? instead of "&" or "}", isn't it the same thing?
Got it , it's kind of a nesting bug
1510504147

Edited 1510504394
Vanakoji
KS Backer
It is related to how roll20 parses the data I believe (note, I can't say the following is 100% accurate). When you have something like ?{Choose|Test,@{selected|str}|y,2} the "}" for the @{selected|str} is parsed as the "}" to end the query, by changing it to the &125; (note this is odd to post here and needs a second layer for this to show up right when posting it) then is will continue on, see the "|" and proper ending "}". It then fills in the &125; with the "}" and references the tempate formating on output as expected. So basically, "}" that are not changed to &125; it taken as the end of the query causing issues.&nbsp; More details beyond what I can explain (I know what to do, not so good at explaining) here&nbsp; <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> EDIT: alright seems you found it first, that is the way to change it, and you can do other things with the character replacement as well. For example here is something I did for a custom chaos monster.so that is would roll the damage when I clicked a button that was put in the chat&nbsp; <a href="https://i.imgur.com/Z7lAYCe.png" rel="nofollow">https://i.imgur.com/Z7lAYCe.png</a> I just click the buttons it outputs and I can roll what ever damage I want on one click, this along with built in macros means I don't ever need to open the sheet when running monsters.
Got it, if I were to explain this, I would say the following: It’s like when you do math by hand, you would represent a equation like this: • ( ( ( 2+2 ) * ( 5+1 ) ) ^2 ) +5&nbsp; &nbsp; "Writing it in a calculator" . This way: • { [ ( 2+2 ) * ( 5+1 ) ] ^2 } +5&nbsp; &nbsp; "Writing it be hand". so you can better visualize which " ) " is ending which " ( ". In this nesting problem, is the same thing, the macro don’t know for sure which " } " would end which " { ", and it screw thing up. So you have to use " &#125 ; " instead of " } ". Note: the " &#125 ; " shouldn't have a space between " 5 " and " ; ", this was necessary to write it here, so that the roll20 chat would not convert it to " } ".
1510571678

Edited 1510571749
Ziechael
Forum Champion
Sheet Author
API Scripter
Also worth noting is that you can nest in nested queries too, you just need to expand the html entity accordingly ie: Query 1 - Uses standard "} | ," syntax Query 2 - Replace all (non attribute calling) syntax with html entity: } = &amp;#125; | = &amp;#124; , = &amp;#44; Query 3 - Replace all (non attribute calling) syntax with html entity and expand the ampersand:&nbsp;} = &amp;amp;#125; | = &amp;amp;#124; , = &amp;amp;#44; Query 4 -&nbsp;Replace all (non attribute calling) syntax with html entity and expand the ampersand AGAIN:&nbsp;} = &amp;amp;amp;#125; | = &amp;amp;amp;#124; , = &amp;amp;amp;#44; And so on and so on!