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

How do you ignore repeating sections when they don't exist?

I've been adapting one of my macros for secret checks to account for Lore skills. I think I've just about got it, but am hoping someone with a bit more knowledge might be able to help me clean it up. Here's the code as it stands now: /w gm &{template:rolls} {{header=Secret Skill}} {{roll01=[[1d20cs20cf1 + ?{skill used|Perception,@{selected|Perception}|Acrobatics,@{selected|Acrobatics}|Arcana,@{selected|Arcana}|Athletics,@{selected|Athletics}|Crafting,@{selected|Crafting}|Deception,@{selected|Deception}|Diplomacy,@{selected|Diplomacy}|Intimidation,@{selected|Intimidation}|Medicine,@{selected|Medicine}|Nature,@{selected|Nature}|Occultism,@{selected|Occultism}|Performance,@{selected|Performance}|Religion,@{selected|Religion}|Society,@{selected|Society}|Stealth,@{selected|Stealth}|Survival,@{selected|Survival}|Thievery,@{selected|Thievery}|@{selected|repeating_lore_$0_lore_name},@{selected|repeating_lore_$0_lore}|@{selected|repeating_lore_$1_lore_name},@{selected|repeating_lore_$1_lore}|@{selected|repeating_lore_$2_lore_name},@{selected|repeating_lore_$2_lore}|@{selected|repeating_lore_$3_lore_name},@{selected|repeating_lore_$3_lore}|@{selected|repeating_lore_$4_lore_name},@{selected|repeating_lore_$4_lore}|@{selected|repeating_lore_$5_lore_name},@{selected|repeating_lore_$5_lore}}]]}} {{roll01_type=skill}} It works great if the selected character has exactly TWO lore skills. However, it doesn't work well for anyone with ONE lore skill or more than two lore skills. In the former case, the dropdown menu breaks. In the latter case, the dropdown menu doesn't show the additional lore skills. How do I adjust this so that it ignores repeating lore skills not possessed by the character?
I can't test this myself, but does it fix it if you add '&{noerror}' to the end? Otherwise it looks properly formed so I have no idea why it would work for 2 lore skills but not 1 or 3+.
Jarren K. said: I can't test this myself, but does it fix it if you add '&{noerror}' to the end? Otherwise it looks properly formed so I have no idea why it would work for 2 lore skills but not 1 or 3+. To the end of what exactly? Everything? I added it to the end of everything and that seemed to stop the errors from appearing in the chat log. That fixes one of my two issues. The chat errors used to look like this every time I used the macro. So that's definitely a plus. Thanks! However, it did nothing to fix the extra lore skills from showing up as broken code in the dropdown menu (shown below): Now I just need it to ignore the additional lores in the dropdown if the character doesn't possess them.
I'm curious what your Lore attributes are -  as they may be causing an issue. What is the output of this macro? Lore 1: @{selected|repeating_lore_$0_lore_name} - @{selected|repeating_lore_$0_lore} Lore 2: @{selected|repeating_lore_$1_lore_name} - @{selected|repeating_lore_$1_lore} Lore 3: @{selected|repeating_lore_$2_lore_name} - @{selected|repeating_lore_$2_lore} Lore 4: @{selected|repeating_lore_$3_lore_name} - @{selected|repeating_lore_$3_lore} Lore 5: @{selected|repeating_lore_$4_lore_name} - @{selected|repeating_lore_$4_lore} Lore 6: @{selected|repeating_lore_$5_lore_name} - @{selected|repeating_lore_$5_lore} There is a way to prevent attributes from displaying in chat using a 'Style Injection' trick, but I don't think it'll work inside a query.  It's likely that you'll need a custom API script to parse through and only display attributes that are present on the sheet.
1618372298
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You could also look into  Universal Chat Menus . It might do what you need without messing with complicated dropdown queries.
Jarren K. said: I'm curious what your Lore attributes are -  as they may be causing an issue. What is the output of this macro? This is what the output looked like when I did Lore 1, Lore 1, Lore 2, Lore 3. The token in question only had two lore skills.
You won't be able to dynamically call the Lore attributes in a dropdown macro query and have Roll20 'ignore' the ones you don't have on the character sheet. I'd suggest looking into keithcurtis' suggestion above of the Universal Chat Menu script, or using a regular Chat Menu macro .