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

Help with Macro calling up NPC actions

1593005835

Edited 1593007446
Hello all!  So I've written this macro to call up NPC actions within Abiity Command buttons: @{selected|wtype} &{template:traits} {{name=@{selected|character_name}'s Actions}} {{description=[@{selected|repeating_npcaction_$0_name}](~@{Selected|repeating_npcaction_$0_npc_action}) [@{selected|repeating_npcaction_$1_name}](~@{Selected|repeating_npcaction_$1_npc_action}) [@{selected|repeating_npcaction_$2_name}](~@{Selected|repeating_npcaction_$2_npc_action})  [@{selected|repeating_npcaction_$3_name}](~@{Selected|repeating_npcaction_$3_npc_action})  [@{selected|repeating_npcaction_$4_name}](~@{Selected|repeating_npcaction_$4_npc_action}) [@{selected|repeating_npcaction_$5_name}](~@{Selected|repeating_npcaction_$5_npc_action})}} And it works! Except for each time I use it it fills the chat with several red error messages along the lines of "No attribute was found for @{Selected|repeating_npcaction_-MAaU0EfuN-eLtTCiLXz_npc_action}" before doing what it's supposed to do, and the perfectionist in me would really rather it just called up the actions without complaining.  Any insights into that one tiny change I'm sure will fix everything?  EDIT: (I realise I didn't specify; I'm using the 5e by Roll20 character sheet) EDIT: Oh! And sorry, as a follow-up:  Obviously as it stands, if an NPC only has three actions, this macro calls up those, and then informs you via red error that the others don't exist.  Is there a macro trick for querying whether the NPC actions exist, and only calling on them if they do?  That'd be amazing, it would make my perfectionist, completionist brain so happy! XD Thanks! T x
1593008554

Edited 1593008960
Oosh
Sheet Author
API Scripter
Just throw &{noerror} in there somewhere. With a template, you can put it pretty much anywhere outside the template fields. At the very start or end of the macro is generally a good bet, just so you can see if you've forgotten or misspelled it. Note that &{noerror} does not seem to work for @{target} calls.... I have no idea why. Without API you can't get do a conditional or looped output unfortunately. The options for cleaning up the output are: - Manually trim the macro for each NPC (loads of work, do not recommend) - Add blank actions to the NPCs so they all have 6 actions (to match the macro calls) - Use Keith's inline links style fix to make them look nicer (thought they'll still be there, this is the easiest and universal solution)
1593009325

Edited 1593009576
That did it Oosh! &{noerror} was exactly what I was looking for.  I don't mind if the macro has unfilled repeating actions, as long as my players aren't being spammed by error codes. Fan-dabby-dozy!  Thanks again, T x
Whoops, I spoke too soon. So having &{noerror} fixes the problem if I have the macro open and editable when I test it (IE, it gets rid of the errors). But if I use it from the bar (Either as a macro from the macro list or as an ability from my "Macros" character sheet) the errors still come up.  Am I being a dunce? T
Never mind! I found the solution in this thread  from two years ago XD T
1593019405
Oosh
Sheet Author
API Scripter
Whoops, forgot about that detail sorry!