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

Token Actions and Character-sheet Actions. Can we link them?

I would LOVE to know if there is a way to make my NPC char sheet actions, like a Scimitar attack or a spell cast, show up as Token Actions. 1) Can that be done automatically as an option on the sheet? 2) If not, how do I format the Token Action abilities added to make them trigger an NPC attack? Thanks!
1506961735
The Aaron
Pro
API Scripter
It seems to be something of an undocumented feature, but you can access sheet actions by their name as you would an ability on the character: %{selected|SomeSheetActionName} Inspect the character sheet in question and look for something that looks like: <button type="roll" name="roll_SomeSheetActionName">My action</button> you drop the roll_ part off the front and that becomes the action name.
I can't seem to figure out how to find the "Roll Name" for something like a weapon action on the Roll20 OGL sheet. If I wanted to create a macro/token action that did that Rapier attack.  I'd set it up as %{selected|????}
1506963810

Edited 1506963863
%{selected|repeating_attack_ROWID_attack} where ROWID is either the specific ID for the attack (useful if the player likes to reorder attacks) or the index ($X where X is the index of the attack from the top, starting at 0). So using the index you could use %{selected|repeating_attack_$0_attack) for the Rapier and %{selected|repeating_attack_$1_attack) for the Dart
Thanks Kyle!
How would i find the specific ID of the attack if I didn't use the index?
1506966435
The Aaron
Pro
API Scripter
You'd inspect the roll, then scroll up until you find something like: <div rowid="-J452134z12d213"> That's the row id to substitute in for the $0
Thanks for your help Aaron and Kyle
Repeating sections are a little trickier to figure out the names, but here is how I find it. In order to get the information from a repeating section, we need to know three parts: The repeating section's name The row ID/index for the specific instance we want The actual information within the repeating section we want. The first highlighted section is the repeating section's name, this will almost always start with repeating_ so that's a big help. The second highlighted section is the row ID for the instance. Typically (Always?) starts with -  and in the HTML will always be in the data-reprowid property. The third highlight section follows The Aaron's method to find out the roll's name. You can also use a similar tactic to find a specific attribute of the item (however attributes are named attr_NAME  instead and referenced with @{}  instead of %{} ).
1506967699

Edited 1506967734
The Aaron
Pro
API Scripter
Oh, better answer, Kyle! Repeating Section names will always start with repeating_ as that's how it determines what it is. (though it's technically the <fieldset class="repeating_..."> line that creates the section.) IDs in Roll20 will always start with a - until GMT: Wednesday, May 15, 2109 7:35:11.104 AM.  They use a UUID (Universal Unique ID) method to generate it based off of time and a random number.  The time portion makes up the first 8 characters of the ID, using a modified Base64 encoding method.  At the listed milisecond, the front of the ID will transition from '-zzzzzzz' to '0-------'.  So in just under 92 years, look out!
1506968917
Jakob
Sheet Author
API Scripter
The Aaron said: Oh, better answer, Kyle! Repeating Section names will always start with repeating_ as that's how it determines what it is. (though it's technically the <fieldset class="repeating_..."> line that creates the section.) IDs in Roll20 will always start with a - until GMT: Wednesday, May 15, 2109 7:35:11.104 AM.  They use a UUID (Universal Unique ID) method to generate it based off of time and a random number.  The time portion makes up the first 8 characters of the ID, using a modified Base64 encoding method.  At the listed milisecond, the front of the ID will transition from '-zzzzzzz' to '0-------'.  So in just under 92 years, look out! Oh, that I means I have to fix my scripts that believe all IDs start with a dash within 92 years.
1506970165
The Aaron
Pro
API Scripter
The real problem will be in 8972 years when we start getting repeats... =D
1506972296
Finderski
Pro
Sheet Author
Compendium Curator
an even easier way to find the ID of a repeating section is to drag the button to the macro bar (assuming you have the macro quick bar enabled).  When the button is dragged to the macro quick bar the name will give you give you the ID.  For example:
1506973241
The Aaron
Pro
API Scripter
Oh, really great tip, Finderski! 
Thanks all!
If you would like to see these already set up for your module purchases and the Monster Manual, you should lend a vote here Token Actions for Monster Manual and paid content.