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

Drop Down combined with Ability Call not working

I have Token Actions for D&D 5e Saving throws that work fine. Example STR_Save %{selected|npc_str_save} I want to combine this with a drop down menu where I can choose the type of save. Save ?{Save|    STR,%{selected|npc_str_save} |    DEX,%{selected|npc_dex_save} } This is not working.  The dialog box that appears does not have drop down arrow and in the text area it has "STR,&{template:npc" instead of just STR. This sample works correctly but I would like the output to show in chat when using %{selected|npc_str_save}: ?{Save|     STR,/roll 1d20 +2[STR] |     DEX,/roll 1d20 +2[DEX] }  If someone could help point me in the right direction, I would appreciate it. Pat Jacobs
1651726334
GiGs
Pro
Sheet Author
API Scripter
You'll find your issue and possible fixes described here: <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>
GiGs said: You'll find your issue and possible fixes described here: <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> Yeah, I have read that multiple times.&nbsp; That section indicates that I should "Never Replace Attributes",&nbsp; Never, ever, do this: &nbsp; @{target&amp;#124;token_name&amp;#125; . Always leave calls alone:&nbsp; @{target|token_name} Regardless I have tried the following: ?{Save| &nbsp; &nbsp;STR,%{selected&amp;#124;npc_str_save&amp;#125; | &nbsp; &nbsp;DEX,%{selected&amp;#124;npc_dex_save&amp;#125;&nbsp;} and I get the following error in chat and then chat goes wonky until I exit and reenter the session. "No ability was found for %{selected&amp;#124;npc_str_save&amp;#125; | DEX,%{selected&amp;#124;npc_dex_save&amp;#125; }"
I found this macro a long time ago and it works for npc's and PC's @{selected|wtype}&amp;{template:simple} @{selected|rtype}?{Save |Strength,+[[(@{selected|strength_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_str_save}*@{selected|npc})]][STR SAVE] ]]}} {{rname=^{strength-save-u}}} {{mod=[[ [[(@{selected|strength_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_str_save}*@{selected|npc})]][STR SAVE] ]]}} {{r1=[[@{selected|d20}+[[(@{selected|strength_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_str_save}*@{selected|npc})]][STR SAVE] ]] |Dexterity,+[[(@{selected|dexterity_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_dex_save}*@{selected|npc})]][DEX SAVE] ]]}} {{rname=^{dexterity-save-u}}} {{mod=[[ [[(@{selected|dexterity_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_dex_save}*@{selected|npc})]][DEX SAVE] ]]}} {{r1=[[@{selected|d20}+[[(@{selected|dexterity_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_dex_save}*@{selected|npc})]][DEX SAVE] ]] |Constitution,+[[(@{selected|constitution_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_con_save}*@{selected|npc})]][CON SAVE] ]]}} {{rname=^{constitution-save-u}}} {{mod=[[ [[(@{selected|constitution_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_con_save}*@{selected|npc})]][CON SAVE] ]]}} {{r1=[[@{selected|d20}+[[(@{selected|constitution_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_con_save}*@{selected|npc})]][CON SAVE] ]] |Intelligence,+[[(@{selected|intelligence_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_int_save}*@{selected|npc})]][INT SAVE] ]]}} {{rname=^{intelligence-save-u}}} {{mod=[[ [[(@{selected|intelligence_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_int_save}*@{selected|npc})]][INT SAVE] ]]}} {{r1=[[@{selected|d20}+[[(@{selected|intelligence_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_int_save}*@{selected|npc})]][INT SAVE] ]] |Wisdom,+[[(@{selected|wisdom_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_wis_save}*@{selected|npc})]][WIS SAVE] ]]}} {{rname=^{wisdom-save-u}}} {{mod=[[ [[(@{selected|wisdom_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_wis_save}*@{selected|npc})]][WIS SAVE] ]]}} {{r1=[[@{selected|d20}+[[(@{selected|wisdom_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_wis_save}*@{selected|npc})]][WIS SAVE] ]] |Charisma,+[[(@{selected|charisma_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_cha_save}*@{selected|npc})]][CHA SAVE] ]]}} {{rname=^{charisma-save-u}}} {{mod=[[ [[(@{selected|charisma_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_cha_save}*@{selected|npc})]][CHA SAVE] ]]}} {{r1=[[@{selected|d20}+[[(@{selected|charisma_save_bonus}@{selected|pbd_safe}*(1-ceil((@{selected|npc})*0.00001)))+(@{selected|npc_cha_save}*@{selected|npc})]][CHA SAVE] ]] }}} {{global=@{selected|global_save_mod}}} @{selected|charname_output}
1651771277
GiGs
Pro
Sheet Author
API Scripter
I think I see the issue, and should have seen it last night. The problem is that this: %{selected|npc_str_save} is not an attribute, it's an Ability Call. For simplicity, when you run a macro, roll20 checks all the attributes, ability calls, and macro calls, and extracts their contents , placing them in the macro. Then the query is run. So imagine npc_str_save includes the following (and likewise for DEX save: &amp;{template:default}{{name=@{character_name}}} {{STR Save=[[1d20+@{str_mod}}} Now you have a macro like this: ?{Save| &nbsp; &nbsp;STR,%{selected|npc_str_save} | DEX,%{selected|npc_dex_save} } When you run it, roll20 extracts and replaces the contents, so you have this: ?{Save| &nbsp; &nbsp;STR,&amp;{template:default}{{name=@{character_name}}} {{STR Save=[[1d20+@{str_mod}}} | DEX,&amp;{template:default}{{name=@{character_name}}} {{DEX Save=[[1d20+@{dex_mod}}} } And then attribute values are replaced (I can't rememvber off-hand if attributes are replaced before the uery runs, but abilities definitely are), so you might have ?{Save| &nbsp; &nbsp;STR,&amp;{template:default}{{name=Goblin}} {{STR Save=[[1d20+0]])} | DEX,&amp;{template:default}{{name=Goblin}} {{DEX Save=[[1d20+3]]}} } And at this point, your dropdown query runs. And now, it stumbles at the first }, thinking thats the end of the query, and your query fails. So, if you want those save abilities to work in tiyur macro, you have to edit them, swapping certain characters with HTML entities. And you either have to do that in the ability being called (making the abiliy break when you try to run it outside of this macro), or ciopy the text of the ability into the macro and edit it directly there. By far the easiest solution to all this, is to replace the query with a chat menu . The code is so much easier and you don't have to edit your other abilities to use them.
1651771645
GiGs
Pro
Sheet Author
API Scripter
The chat menu version of your macro would look like this: /w GM &amp;{template:default} {{name=NPC Saves}} {{=[STR](~selected|npc_str_save) [DEX](~selected|npc_dex_save)}} Just add extra buttons to the end ofr each needed save. The button code is: [VISIBLE LABEL](~selected|ABILITY-NAME) Just replace the bits in ALL Caps.