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

Repeating_Attack Macro no longer working as intended

Hi, Our group is playing D&D with the 5e OGL sheet. This is my first time creating a thread like this, but I'm fairly certain this is the right place and the right way to do this - please be kind if it's not. I originally set up universal macros with chat menu functionality so that players had an alternative to quickly choose actions during the game. I did this almost a year ago for things like Attacks and Spellcasting, their Spellbook, and even one for their Resources. Each macro calls different repeating values and the macros are lengthy enough to allow for 20 items in each category (ranging from $0 to $19 respectively). This is what I looked like when working properly: However, over the past week something has changed within Roll20 and my players who use the Attacks and Spellcasting macro are finding that the macro is no longer hiding the empty results and instead displays the pure macro code inline with the rest of the chat menu result that did work. Previously - and until this week - if they had 5 things they could attack with (a few weapons and/or spells like shown above), it would display results only for those that they had and would hide the rest with ${noerror} since the macro is coded up to 20 items. I made these universal so that any character could use them, and that's why I had it range to 20 items since it would dynamically show only the items that a certain player had, and I did this using the @{selected| ... function. Now, the result my players get looks like the image below. For the sake of easy reading and identifying each segment of the macro, I've put each section of the Actions list as a new line in the code whereas otherwise everything would run in a single line of code for this one macro. I've looked through the forums but wasn't able to find anything recent on this topic, or that others had experienced this specific issue. As far as I can tell, my ${noerror} function is working properly because it's not giving me errors  in the chat... it's just reading the macro as text and doesn't seem to be hiding the repeating results where values don't exist. I've got both display: none; and  display: inline-block  in my code so it should be utilizing those functions to hide $6, $7, and $8 in the image above... right? Here's some of the code I'm working with - I've removed the {{charname}} and {{range}} sections for this copy-paste to save space, as well as limited it to $0 to $8 items. This is enough code for it to work and get the idea across. /w @{selected|character_name} &{template:atk} &{noerror} {{desc=[-- Actions --](" style="background: none; background-color: #943126; border: 4px solid; border-color: white; padding: 5px; font-size:14px; text-decoration: White; display:none; color: #FFFFFF; text-align: center; font-weight: bold; display: block;) [@{selected|repeating_attack_$0_atkname}](~selected|repeating_attack_$0_attack" style="background: none; background-color: #F5B7B1; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$0_atkname|max};) [@{selected|repeating_attack_$1_atkname}](~selected|repeating_attack_$1_attack" style="background: none; background-color: #F1948A; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$1_atkname|max};) [@{selected|repeating_attack_$2_atkname}](~selected|repeating_attack_$2_attack" style="background: none; background-color: #F5B7B1; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$2_atkname|max};) [@{selected|repeating_attack_$3_atkname}](~selected|repeating_attack_$3_attack" style="background: none; background-color: #F1948A; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$3_atkname|max};) [@{selected|repeating_attack_$4_atkname}](~selected|repeating_attack_$4_attack" style="background: none; background-color: #F5B7B1; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$4_atkname|max};) [@{selected|repeating_attack_$5_atkname}](~selected|repeating_attack_$5_attack" style="background: none; background-color: #F1948A; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$5_atkname|max};) [@{selected|repeating_attack_$6_atkname}](~selected|repeating_attack_$6_attack" style="background: none; background-color: #F5B7B1; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$6_atkname|max};) [@{selected|repeating_attack_$7_atkname}](~selected|repeating_attack_$7_attack" style="background: none; background-color: #F1948A; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$7_atkname|max};) [@{selected|repeating_attack_$8_atkname}](~selected|repeating_attack_$8_attack" style="background: none; background-color: #F5B7B1; border: 1px solid; border-color: #909497; outline: 0px solid; outline-color: white; border-radius: 5px; margin-bottom: 1px; padding: 2px; padding-left: 6px; padding-right: 6px; line-height: 1; font-size:11px; text-indent: 5px; text-decoration: none; font-style: normal; display: none; color: Maroon; display: inline-block@{selected|repeating_attack_$8_atkname|max};)}} Does anyone have any insight as to why my code is no longer working and hiding the values that are not present on a character sheet? I should also note that I use a separate macro to call this macro, and both use the &{noerror} function.
1663454710

Edited 1663455242
I had the same issue with my universal chat menu. I found the fix and explained it  here .
Jarren said: I had the same issue with my universal chat menu. I found the fix and explained it  here . Thank you very much! I missed that thread but your explanation was very helpful. I can't believe the solution was as easy as hitting the space bar 20 times. 😅 I'll clean up my code shortly, but for now I'm very appreciative that it's working properly again!
FYI just glancing at the style you're injecting into your buttons, and you have some extraneous code in there. As long as you're cleaning up your code you may be interested in some other changes. (Though I'll be honest that I'm not a web developer or anything, so it's definitely possible you had valid reasons for some of these things that I'm unaware of!) You've got conflicting background style. background: none; background-color: #F5B7B1; background-color: #F5B7B1; You could shorthand some of your border style. border: 1px solid; border-color: #909497; border-radius: 5px; border: 1px solid #909497; border-radius: 5px; You don't need to set the color of a 0px outline... and I don't think you need to set a 0px outline at all for 5E roll templates. (I didn't see any outline property applied to rolls using the atk template.) outline: 0px solid; outline-color: white; outline: 0px solid; outline-color: white; You could shorthand your padding. padding: 2px; padding-left: 6px; padding-right: 6px; padding: 2px 6px; The line-height property won't do anything unless it is called in the parent element, and it won't make the line-height shorter than any text height. line-height: 1; line-height: 1; You don't need to set the font-style at all for 5E roll templates.  (I didn't see any font-style property applied to rolls using the atk template.) font-style: normal; font-style: normal; I don't see anything to change here. font-size: 11px; text-indent: 5px; text-decoration: none; color: Maroon; display: none; display: inline-block@{selected|repeating_attack_$0_atkname|max} So you should get the same result using this much shorter code: background-color: #F5B7B1; border: 1px solid #909497; border-radius: 5px; padding: 2px 6px; font-size: 11px; text-indent: 5px; text-decoration: none; color: Maroon; display: none; display: inline-block@{selected|repeating_attack_$0_atkname|max};
Jarren said: FYI just glancing at the style you're injecting into your buttons, and you have some extraneous code in there. As long as you're cleaning up your code you may be interested in some other changes. (Though I'll be honest that I'm not a web developer or anything, so it's definitely possible you had valid reasons for some of these things that I'm unaware of!) Thanks for the feedback. Cheers!
Also, in case you're interested I just updated my Universal Chat Menu as well.  I realized that it wasn't functional for players to use (as everything was set to '/w gm' and set it up so that it'll whisper NPC info only to the GM, but PC info to controlling players, along with a way to circumvent that on a per-player basis to whisper to the player directly.
Cool, thanks for the heads up and the work you've put into that - I'll check it out. I've had my menus always set up with '/w @{selected|character_name}' so that as long as we have our desired tokens selected, my players and I can use use the desired macros with great effect. I use these for my NPCs as well and only resort to an Alt+Click when I really need to get more information about what's available on a given sheet. Thanks again!