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 I call the name of a repeating_npcaction ?

I have several Ability macros that I use on all my npc character sheets. Each macro itself is pretty simple, for example: %{selected|repeating_npcaction_$0_npc_action} calls the first item in the "Actions" list on the character sheet. I have this checked as a Token Action, so that when I select the token on my map, that action is shown as a button on the top left of my map. On an Orc, for example, that Action is a "Greataxe", so I open the Attributes and Abilities page of the Wererat journal and then edit that Ability, and make the name of the Ability "Greataxe". This makes the Token Action button on my map have the name "Greataxe" on it, so I know what it does. Now lets say I want to create a variant of this monster, and Orc Archer, so I duplicate this sheet, modify the stats and things on the Character Sheet, and now, the first Action is not a "Greataxe", its a "Heavy Crossbow". So now I have to go in to the Ability again and rename the Ability to "Heavy Crossbow".  Is there a syntax that can call the Name of the Action? So, instead of having to open the Attributes and Abilities tab and modify the name of every Ability that calls an Action, I can put in this syntax and it will fill in the right name on my button? So now, on the  Attributes and Abilities tab, if I edit an Ability, it will look like this: "some syntax I am asking about" %{selected|repeating_npcaction_$1_npc_action} Does anyone know how to do this?
1667594021
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Waargrin! If you are talking about renaming the name of the action itself, then no, not without a Mod script. If you are talking about referencing it in the body of the macro, the format would be: @{selected|repeating_npcaction_$1_name} "1" would of course be the second action, since Roll20, like JavaScript is 0-indexed. You could look into something like Jarren's excellent No API Required universal chat menu.
OK, I tried putting that in the "Name" box of the Ability, but, as I think you were saying in your response, that does not work. It just makes the Token Action button say " @{selected|repeating_npcaction_$1_name}"  in the top left of my map.  So, can I make a Token Action that makes buttons in chat that i can clikc? I think i remember seeing that. If I can, is it possible to call the Name of the Action in that context, so the button that shows up in Chat is named the name of the Action?
1667612550
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Correct on both counts. TO auto name the action itself requires a Mod Script, most likely Token Action Maker. As for your second question, absolutely, that's what the last link I posted tells how to do. The full macro calls up probably way more than you need, but I believe it is more or less modular. To make such a macro universally available, save it as a collections macro, with permissions for all players, and click the option to make it a token macro. It will show up for any selected token.
1667622262

Edited 1667623696
Hi Keith, Thanks, this is getting me where I want to go. I have a couple more questions. I am using the code below to make a Macro that is a Token Action available whenever I select a Token, as you suggested. This just does Actions, which is all I want: I have one Token Action called "Actions": #ActionsMacro &{noerror} That calls another macro called "ActionsMacro": /w gm &{template:npcaction}{{rname=@{selected|character_name}}}{{name=**Actions** [@{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) }} &{noerror} however, there is one problem. The output also includes error text in the whisper for each repeating action that the npc sheet does not have. I read through the posts in the thread you linked. I went to Jarrens updated version, as you can see. I still don't quite get how to get rid of those error lines. I don't want to have to open every npc sheet and add blank actions...but maybe that's the only way to do it?
My chat menus are designed to be 'universal', in that they don't need to be put on each npc sheet, and they automatically do not display missing repeating actions.  Instead, you create collection macros or a 'macro mule' character, and call those with a collection macro set as a Token Action. Your code is missing the part that prevents missing repeating actions from displaying, so I'm guessing you got it from another post  which was my initial inspiration for the universal chat menu. Did you follow the setup instructions on the linked thread?
1667663418
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, I linked Jarren's thread specifically. My initial foray into the idea did not have the error-avoiding technique. At the end of my first post, there's a huge disclaimer and redirect to Jarren's because of this. I should probably move that to the top.