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

Attaching Character Sheet Attack Macros to Tokens?

I dragged the macro from the character sheet (Roll20 D&D 5e) to the main macro bar in an attempt to get the name, and after unsuccessfully trying to copy and paste the name out of the button I then tried typing the provided name manually into an "Abilities" macro on the character sheet (preceding it with a '#') so I could have it show up as a Token Action, but there's evidently something missing from the provided name.  I tried it with and without the leading character name, colon and space, as well as trying both a lower-case "L" and an upper-case "I" where those showed up in the auto-generated name, and each time I tried the Token Action all I got in the chat window was a repeat of the text from the "Abilities" box, which I interpret as not recognizing the name of the macro.  I hate duplicating effort and I like the format from the attack macros and the way they automatically add magic and crit damage on the appropriate die roll.  Any suggestions as to how I might be able to find the True Name for these macros?  Thanks Much.
1589386078
Oosh
Sheet Author
API Scripter
If you click on an attack from your Attacks & Spellcasting section so it throws out an attack roll in the chat log, you can click your mouse in the chat bar then push the UP arrow on your keyboard, it should fill your chat bar with the previous command in the log: in this case, the template for the attack you just clicked. It should look something like this: @{Drew|wtype}&{template:atk} {{mod=+8}} {{rname=[Dagger](~-M02-csceHyRLYn7dXLZ|repeating_attack_-LqPKgatCGxQaxYzAUnj_attack_dmg)}} {{rnamec=[Dagger](~-M02-csceHyRLYn7dXLZ|repeating_attack_-LqPKgatCGxQaxYzAUnj_attack_crit)}} {{r1=[[@{Drew|d20}cs>20 + 5[DEX] + 3[PROF]]]}} @{Drew|rtype}cs>20 + 5[DEX] + 3[PROF]]]}} {{range=20/60}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{Drew|global_attack_mod}}} ammo= @{Drew|charname_output} or if you click the macro you dragged onto the macro bar from the same place, probably like this: %{Drew|repeating_attack_-Lr6N37qE6QW6oYqFZrd_attack} If all you're trying to do is move your weapon attack into the character ability section so you can make it a Token Action, the second format will work fine, just throw it in there, name it and tick the token action box. If you want to mess around with anything, you want the full template as in the first example. If you want to mess around with templates, this page will help, combined with picking apart the output from the sheet.
1589386446
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Bill, This script can save you a lot of time. It will do this automatically for any selected token. Let me know if you need any assistance installing or using it. Token Action Maker If you still need the name for any further programming, you can get it by opening the resulting token action. (Pro Tip: Shift click on any macro or token action button to open it in the editor)
Thank you both very much!  I did eventually find the %{selected|repeating_attack_$0_attack} syntax, but I have misgivings about that since it will get messed up if the player changes the order of the actions in the list.  The Token Actions also looks promising; I'll definitely have to play around with that.
1589400063

Edited 1589400121
Kraynic
Pro
Sheet Author
If you follow up my instructions for getting the dynamic roll, you can do this from a repeating section and get the exact row ID that gets generated when that row/item/attack/spell was created.  It will be a string of letters and numbers instead of $#.  You won't be turning that into a universal macro using selected, but it could certainly be entered as a character ability (Attributes & Abilities tab of the character it came from) and marked as a token action so that it is available any time the token for that character is selected.  If you do that, the exact ID will pull the correct attack/spell/whatever even if it has been moved to another place in the repeating section.
1589402940
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might also get some useful info from this: NPC Statblock Chat Menu for D&D 5e sheet — No API required!