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

Query Macro Parsing Issue

1493578083

Edited 1493580713
Hello everyone, I am using the 5e Community Sheet and trying to create some Macros that I will eventually apply to tokens. I have created a Query Macro that then tries to perform a call depending on the choice of the query, but I'm running into some issues with HTML parsing. I understand that I should be replacing SOME of my "|" "}" and "," characters with the HTML replacements, but I cannot, for the life of me, figure out which ones to do it with. Below is the query in its totally non-replaced format. Any pointers on which characters need replacing? ?{Saving Throws| Strength Save,%{Selected|Strength_Save}| Dexterity Save,%{Selected|Dexterity_Save}| Constitution Save,%{Selected|Constitution_Save}| Wisdom Save,%{Selected|Wisdom_Save}| Intelligence Save,%{Selected|Intelligence_Save}| Charisma Save,%{Selected|Charisma_Save}| Death Save,%{Selected|Death_Saving_Throw} } Any tips? EDIT: To clarify, each one of these called action (such as %{Selected|Dexterity_Save}, to give an example} works just fine as their own macro. I was just hoping to consolidate them all into one master Macro, so I could have a universal macro for all my PCs and any enemy/NPC tokens I make.
Just take out all the line breaks honestly. None of that needs to be escaped from what I can see.
1493581557

Edited 1493587258
SFX said: Just take out all the line breaks honestly. None of that needs to be escaped from what I can see. I originally had the macro without any line breaks: ?{Saving Throws|Strength Save,%{Selected|Strength_Save}|Dexterity Save,%{Selected|Dexterity_Save}|Constitution Save,%{Selected|Constitution_Save}|Wisdom Save,%{Selected|Wisdom_Save}|Intelligence Save,%{Selected|Intelligence_Save}|Charisma Save,%{Selected|Charisma_Save}|Death Save,%{Selected|Death_Saving_Throw}} and it exhibited the exact same behavior - no drop down query, only a text box, with the title "Strength Save,&{template:5eDefault" Since it doesn't seem to be capturing where the Query and Call parameters end and begin, I am assuming it is a parsing issue. I've used lots of different combinations, but none seem to work.
Ahh, see the stuff in the calls is not escaped. You'd have to go in and escape each one of those buttons or macros and then run it. which basically amounts to writing them all by hand. :/
SFX said: Ahh, see the stuff in the calls is not escaped. You'd have to go in and escape each one of those buttons or macros and then run it. which basically amounts to writing them all by hand. :/ Hmmm. Sorry, I'm not very familiar with much of the terminology... in this case, what does "escaped" mean? And do you have any direction you could point me in to know how to go about writing them out by hand? LOL Explain it to my like I'm five, if you have the time. 
He's referencing the advanced usage for roll queries . The calls don't need to be escaped but everything in the macro it calls needs to be.
1493642719

Edited 1493642821
So the problem that you are running into here is that macro queries break at the first '}' they come across. If you have a query call an ability or another macro, you will need to replace all the '}', '|', and ',' with their respective HTML equivalents: }, |, and , within those other abilities. What this means is that you can't call those abilities individually any more as their roll templates will not work without being inside a query. Please see  here for more information.
What you can do is build the macro from scratch instead of calling out to a previously made sheet macro. If you check out this old thread you can see the original solution I came up with. Here and here . These days I use ability command buttons instead of a drop down, which is a different method but can be simpler.
1493645087

Edited 1493645379
Kyle G. said: So the problem that you are running into here is that macro queries break at the first '}' they come across. If you have a query call an ability or another macro, you will need to replace all the '}', '|', and ',' with their respective HTML equivalents: }, |, and , within those other abilities. What this means is that you can't call those abilities individually any more as their roll templates will not work without being inside a query. Please see  here for more information. Right, this is what I was assuming to be my problem (if you see my OP). The problem is that I can't figure out how to parse the replacement HTML objects correctly. I put together the below string that I know doesn't work, but follows the logic of replacing every "}" "|" and "," in the macro after the point where the first "}" would appear, but this is giving me an error of "No ability was found for <huge string of all the above calls at once>", so I know I am overlooking something. See OP for original string, below is a modified replacement string I put together: Any thoughts on where I'm going wrong?
It doesn't work that way. The % is a call for a roll from the character sheet, I don't think there is any way to make that work with a pull down. If you were just calling the attributes you don't need to escape those @{selected|strength_mod} would not need to be escaped because the attribute gets filled in with the value of that attribute before the query. See my link to the old post above and it will show the the way to make it work.
Ed S. said: What you can do is build the macro from scratch instead of calling out to a previously made sheet macro. If you check out this old thread you can see the original solution I came up with. Here and here . These days I use ability command buttons instead of a drop down, which is a different method but can be simpler. Thanks for the feedback, Ed. I am trying to take a stab at the Ability Command Buttons, but am having a stumbling block. I started with something simple, an Ability I have set up in character sheets that rolls for Initiative (cleverly named Initiative). Using the format in the Wiki, I put this together... [Initiative](Selected|Initiative) But am getting nothing. I feel like I'm missing something? Thanks in advance for your help!
1493647312

Edited 1493647372
Ed S. said: It doesn't work that way. The % is a call for a roll from the character sheet, I don't think there is any way to make that work with a pull down. If you were just calling the attributes you don't need to escape those @{selected|strength_mod} would not need to be escaped because the attribute gets filled in with the value of that attribute before the query. See my link to the old post above and it will show the the way to make it work. Hey Ed, I saw your reply, but rebuilding the rolls themselves actually is what I'm trying to avoid. Not because of the work involved, but because you lose some of the functionality when rolling outside of the sheet. Example: I have a 5E Class Action set up for my barbarian that runs whenever I roll a Dexterity Save it shows I have Advantage, due to the Danger Sense ability. Rolling within the sheet lets me key up these internal macros to the sheet. It also lets me activate magical weapon special abilities automatically whenever I roll that magic weapon's attack as well (as well as a host of other things I use those Class Actions for). I was looking to collate all those rolls into one Macro that allows for a drop down, but if that's not possible, I'll probably just stick with the different individual Saving Throw macros. I don't want to lose the built in functionality of the sheet in any efforts I do. 
Fast Jimmy said: [Initiative](Selected|Initiative) But am getting nothing. I feel like I'm missing something? Thanks in advance for your help! I think your issue here may be a missing '~'. Try this [Initiative](~selected|Initiative) I don't use this sheet so I don't know if it may be another issue. This was just a possible syntax issue that I saw.
Kyle G. said: Fast Jimmy said: [Initiative](Selected|Initiative) But am getting nothing. I feel like I'm missing something? Thanks in advance for your help! I think your issue here may be a missing '~'. Try this [Initiative](~selected|Initiative) I don't use this sheet so I don't know if it may be another issue. This was just a possible syntax issue that I saw. AH! Derp - that worked exactly right. Thanks!
So, I'm now going down the rabbit hole of the Ability Command Buttons. These seem to have some promise, as I was able to easily bring all the Character Sheet rolls for my Saves into one macro quite quickly. The problem I am having is actually with the Chat Text presentation. The boxes look nice, but are chopped up by the text box somewhat, so that the Strength and Dex Saves may be in one chunk of text, while the remaining Saves are in another one. Similarly, I was hoping to build a similar Macro to link Character Sheet Skills, but there are 24 of these altogether (not including any Custom Skills), which I am thinking may be pretty cumbersome for someone to sort through.  Is there any way to modify or control the output of the Ability Command Buttons in the chat box? Thanks again so much guys - I really appreciate the help!
You can use HTML tags to customize the output however you like. For example, if you want to separate the buttons to individual lines put <br> between the buttons.
1493662357

Edited 1493662377
Fast Jimmy said: Ed S. said: It doesn't work that way. The % is a call for a roll from the character sheet, I don't think there is any way to make that work with a pull down. If you were just calling the attributes you don't need to escape those @{selected|strength_mod} would not need to be escaped because the attribute gets filled in with the value of that attribute before the query. See my link to the old post above and it will show the the way to make it work. Hey Ed, I saw your reply, but rebuilding the rolls themselves actually is what I'm trying to avoid. Not because of the work involved, but because you lose some of the functionality when rolling outside of the sheet. Example: I have a 5E Class Action set up for my barbarian that runs whenever I roll a Dexterity Save it shows I have Advantage, due to the Danger Sense ability. Rolling within the sheet lets me key up these internal macros to the sheet. It also lets me activate magical weapon special abilities automatically whenever I roll that magic weapon's attack as well (as well as a host of other things I use those Class Actions for). I was looking to collate all those rolls into one Macro that allows for a drop down, but if that's not possible, I'll probably just stick with the different individual Saving Throw macros. I don't want to lose the built in functionality of the sheet in any efforts I do.  That is the exact reason why I switched to ability command buttons, lol.
Fast Jimmy said: So, I'm now going down the rabbit hole of the Ability Command Buttons. These seem to have some promise, as I was able to easily bring all the Character Sheet rolls for my Saves into one macro quite quickly. The problem I am having is actually with the Chat Text presentation. The boxes look nice, but are chopped up by the text box somewhat, so that the Strength and Dex Saves may be in one chunk of text, while the remaining Saves are in another one. Similarly, I was hoping to build a similar Macro to link Character Sheet Skills, but there are 24 of these altogether (not including any Custom Skills), which I am thinking may be pretty cumbersome for someone to sort through.  Is there any way to modify or control the output of the Ability Command Buttons in the chat box? Thanks again so much guys - I really appreciate the help! Can you upload a screen shot? Then maybe we can get it fixed up looking nice. Oh, what I did is make a drop down for the button, so I select a drop down of which skill and it outputs the button to chat. You or the player can then click the button in the chat, it seems like an extra step, but it saves on chat space.
1493669208

Edited 1493669868
Ed S. said: Fast Jimmy said: So, I'm now going down the rabbit hole of the Ability Command Buttons. These seem to have some promise, as I was able to easily bring all the Character Sheet rolls for my Saves into one macro quite quickly. The problem I am having is actually with the Chat Text presentation. The boxes look nice, but are chopped up by the text box somewhat, so that the Strength and Dex Saves may be in one chunk of text, while the remaining Saves are in another one. Similarly, I was hoping to build a similar Macro to link Character Sheet Skills, but there are 24 of these altogether (not including any Custom Skills), which I am thinking may be pretty cumbersome for someone to sort through.  Is there any way to modify or control the output of the Ability Command Buttons in the chat box? Thanks again so much guys - I really appreciate the help! Can you upload a screen shot? Then maybe we can get it fixed up looking nice. Oh, what I did is make a drop down for the button, so I select a drop down of which skill and it outputs the button to chat. You or the player can then click the button in the chat, it seems like an extra step, but it saves on chat space. AH! I hadn't thought about using a dropdown to prompt the Ability Command - that seems like the exact thing I'd want. EDIT: Deleting because I had made a mistake.
Ed S. said: Fast Jimmy said: So, I'm now going down the rabbit hole of the Ability Command Buttons. These seem to have some promise, as I was able to easily bring all the Character Sheet rolls for my Saves into one macro quite quickly. The problem I am having is actually with the Chat Text presentation. The boxes look nice, but are chopped up by the text box somewhat, so that the Strength and Dex Saves may be in one chunk of text, while the remaining Saves are in another one. Similarly, I was hoping to build a similar Macro to link Character Sheet Skills, but there are 24 of these altogether (not including any Custom Skills), which I am thinking may be pretty cumbersome for someone to sort through.  Is there any way to modify or control the output of the Ability Command Buttons in the chat box? Thanks again so much guys - I really appreciate the help! Can you upload a screen shot? Then maybe we can get it fixed up looking nice. Oh, what I did is make a drop down for the button, so I select a drop down of which skill and it outputs the button to chat. You or the player can then click the button in the chat, it seems like an extra step, but it saves on chat space. Okay! I am moving forward, having good progress now (ignore the above post, LOL).  I have two follow-up questions, if you have the time. 1) Does an Ability need to be set up with every single sheet? I was thinking about doing this with skills and that's 20+ abilities per sheet. Or is there a way to use an Ability Command Button with a Global macro? 2) Will the same appraoch work on PC Abilities as NPC Abilities?
1493670692

Edited 1493670709
1) You can insert macros into the ability command buttons but the syntax is a little different. These would technically be called  API command buttons . Long story short for macros you need to do [Macro](!
#MacroName) 2) Not really sure what you are asking
Kyle G. said: 1) You can insert macros into the ability command buttons but the syntax is a little different. These would technically be called  API command buttons . Long story short for macros you need to do [Macro](!
#MacroName) 2) Not really sure what you are asking Thanks Kyle! For #2, with the 5E Community Sheet, there are often separate NPC attributes/values than the PC ones. My goal is to make a single way for me to do Saves for all PCs and NPCs, depending on the token selected (and the same as well for Skills, but I figure Saves would be an easier mountain to climb starting out).  To give some background, my group meets IRL, but uses Roll20 for the maps, lighting, sheets and dice - the convenience is so amazing, even in a real life game. We are now working on building a gaming table with a flat screen inside and I want to have my players keep the ability to move their tokens around, but pulling up multiple character sheets for each player on one big flat screen is a real problem. So my goal is to get everything that they would have rolled on the Character Sheet into a Token Action. That being said, I'll take a look at the API Command Button instead - thanks for the ongoing support!
I made up an separate Characters sheets to hold my macros named PC_Macros and NPC_Macros and one named Skills. I put the generic ability command button macros on those sheets and reference them from Players character's sheets. That way you don't have to mess with the API button syntax that Kyle G. mentioned. For using the same macro for both PC and NPC it is tough but doable. You have to add some complicated math and a new attribute to each character sheet, is_pc=0 or 1. I have also run into problems because of the way sheet workers acts on the sheet, so I don't know if it's a route you want to take.
I'm not very familiar with the Shaped sheet (I use the 5e OGL sheet myself) but you may find this bit of syntax helpful. [[@{npcd_str_mod}*{1@{npc_str_save}0,0}=10+0@{npcd_str_save}]] What this does is check to see if the npc_str_save attribute is blank or not. If it is, it uses the npcd_str_mod attribute instead. For example, in a case where npcd_str_mod = 3 and npc_str_save = blank. [[3*{10,0}=10+0]]  ->  [[3*1+0]] -> [[3]] Or when npcd_str_mod = 3 and npc_str_save = 5 [[3*{150,0}=10+05]]  ->  [[3*0+05]]  -> [[5]]
1493674040

Edited 1493674065
Ed S. said: I made up an separate Characters sheets to hold my macros named PC_Macros and NPC_Macros and one named Skills. I put the generic ability command button macros on those sheets and reference them from Players character's sheets. That way you don't have to mess with the API button syntax that Kyle G. mentioned. For using the same macro for both PC and NPC it is tough but doable. You have to add some complicated math and a new attribute to each character sheet, is_pc=0 or 1. I have also run into problems because of the way sheet workers acts on the sheet, so I don't know if it's a route you want to take. Hmmmm... that sounds like a tough work around on all fronts. I think I may just take the lazy way out - make all NPCs using PC sheets, then just tie each attack/spell/what-have-you to a Class Action, which are formatted very similar to the Actions of the NPC sheet. My goal is to make my NPCs also have all Token Actions, so setting them up as PC sheets won't be any harder to handle and allow me global macros. Using the format Kyle provided, I was able to use the API Command Button in a Query!  I ran into some trouble with the system saving the "&#13 " portion of the Macro, as it kept on trying to delete it if I ever reloaded the page. But I used the "pre" HTML element to keep it alive, so to speak. So... victory! I think at least.  What I did was set up a Macro that rolled a Save from the selected token, as written below. These Saves were NOT Token Actions or viewable by any players: %{Selected|Strength_Save} I did this for all my Saves. After setting up my Macros, I used the API Command Button format to create the below Query: This works with all my PCs and, as mentioned above, my test NPC I am using a PC sheet for now. I am going to try and tackle Skills using the same logic, hopefully it won't have issues! Thanks again to everyone who answered, especially Kyle and Ed! You all have helped me immensely.
Good luck and happy gaming!