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

Chat Menu: What's the difference between "Test Macro" and running the Macro for real

1599506317

Edited 1599511380
I created (lifted) three macros based on keithcurtis and oosh's excellent work here:&nbsp; <a href="https://app.roll20.net/forum/post/8349326/npc-statblock-chat-menu-for-d-and-d-5e-sheet-no-api-required" rel="nofollow">https://app.roll20.net/forum/post/8349326/npc-statblock-chat-menu-for-d-and-d-5e-sheet-no-api-required</a> &nbsp; I created an NPCSpell sheet, an NPCStats, and an NPCActions chat menu.&nbsp; Here's NPCActions: /w gm &amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|character_name}}} {{name=@{selected|npc_type}}} {{description= **Traits** [@{selected|repeating_npctrait_$0_name}](~selected|repeating_npctrait_$0_-npc_roll_output|err@{selected|repeating_npctrait_$0_name|max}) [@{selected|repeating_npctrait_$1_name}](~selected|repeating_npctrait_$1_-npc_roll_output|err@{selected|repeating_npctrait_$1_name|max}) [@{selected|repeating_npctrait_$2_name}](~selected|repeating_npctrait_$2_-npc_roll_output|err@{selected|repeating_npctrait_$2_name|max}) [@{selected|repeating_npctrait_$3_name}](~selected|repeating_npctrait_$3_-npc_roll_output|err@{selected|repeating_npctrait_$3_name|max}) [@{selected|repeating_npctrait_$4_name}](~selected|repeating_npctrait_$4_-npc_roll_output|err@{selected|repeating_npctrait_$4_name|max}) [@{selected|repeating_npctrait_$5_name}](~selected|repeating_npctrait_$5_-npc_roll_output|err@{selected|repeating_npctrait_$5_name|max}) **Actions** [@{selected|repeating_npcaction_$0_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcaction_$0_name|max}|repeating_npcaction_$0_npc_action) [@{selected|repeating_npcaction_$1_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcaction_$1_name|max}|repeating_npcaction_$1_npc_action) [@{selected|repeating_npcaction_$2_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcaction_$2_name|max}|repeating_npcaction_$2_npc_action) [@{selected|repeating_npcaction_$3_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcaction_$3_name|max}|repeating_npcaction_$3_npc_action) [@{selected|repeating_npcaction_$4_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcaction_$4_name|max}|repeating_npcaction_$4_npc_action) [@{selected|repeating_npcaction_$5_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcaction_$5_name|max}|repeating_npcaction_$5_npc_action) **Reactions** [@{selected|repeating_npcreaction_$0_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcreaction_$0_name|max}|repeating_npcreaction_$0_npc_action) [@{selected|repeating_npcreaction_$1_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcreaction_$1_name|max}|repeating_npcreaction_$1_npc_action) [@{selected|repeating_npcreaction_$2_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcreaction_$2_name|max}|repeating_npcreaction_$2_npc_action) [@{selected|repeating_npcreaction_$3_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcreaction_$3_name|max}|repeating_npcreaction_$3_npc_action) [@{selected|repeating_npcreaction_$4_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcreaction_$4_name|max}|repeating_npcreaction_$4_npc_action) [@{selected|repeating_npcreaction_$5_name}&nbsp;](~@{selected|character_name}|err@{selected|repeating_npcreaction_$5_name|max}|repeating_npcreaction_$5_npc_action) }} There's a lot of code in there that is supposed to block the error codes from showing when you call repeating sections that don't exist.&nbsp; When I'm looking at the macro and hit "Test Macro", the output looks beautiful. But when I run the macro from the chat (i.e.&nbsp; #NPCActions) or I use the token action button, all of the errors appear in the chat for each missing repeatable call.&nbsp; And after that, the input comes out correctly. So... can anybody figure out where the bug is in the code?&nbsp; Is it on roll20's side? *Edit*:&nbsp; It's probably important to note that I am also using the Stylus extensions that are in that forum thread.&nbsp; The relevant stylus css is .sheet-rolltemplate-npcaction a[href*="|errselected"] { display:none !important; }
1599526167
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Make the last line: }} &amp;{noerror} That will suppress error messages for non-existent attributes.
1599528788
Oosh
Sheet Author
API Scripter
For some reason, &amp;{noerror} doesn't seem to work properly from the macro bar sometimes. Creating a second macro and putting that on the bar: &amp;{noerror}#NPCActions fixes it, though I have no idea why. Since you're using Stylus, another option is to disable the messages altogether, saving as its own style so you can switch it off when you're testing macros: .message.error { display:none; } if you use any @{target|} macros that call potentially non-existent Attributes, you'll need to use the Stylus fix - I've never found a way to get &amp;{noerror} to work with those.
1599529233
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Good idea on the Stylus fix. Of course, all players will need to have it installed or someone's going to see it.
1599532628
Oosh
Sheet Author
API Scripter
For the pink/orange/salmon coloured error messages? Nah, they only pop for the person running the macro. And the stuff sent to chat is "/w gm"... players shouldn't be running NPC macros, surely? Unless they're pesky Moon Druids.
You two are awesome!&nbsp; Thank you so much for your replies.
1599538419
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oosh said: For the pink/orange/salmon coloured error messages? Nah, they only pop for the person running the macro.&nbsp; D'oh! You're right, of course.