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

Macro Command Button Help

1587426893

Edited 1587426957
Tom
Pro
Sheet Author
So I'd like to include a "damage roll" button in my attack macro.  I have an Ability called Attack-Damage1.  But when I put this command into a second macro: [Roll Damage](~Attack-Damage1) I get this error:  TypeError: Cannot read property 'substring' of undefined Anyone have any ideas? If it helps, the attack damage macro is simply: &{template:default} {{name=Attack Damage}} {{Damage=[[@{damage1}]]}} Thank you!
Try using # instead of ~ and are you using this macro as a character ability or just has a macro?
1587430413
GiGs
Pro
Sheet Author
API Scripter
This syntax [Roll Damage](~Attack-Damage1) is for buttons on a character sheet. Not sure it works for user-created Abilities. For those, you probably need to use [Roll Damage](~ !&amp;#13;&amp;#37;{ Attack-Damage1}) as described here:&nbsp; <a href="https://wiki.roll20.net/API:Chat#Entering_API_Buttons_In_Chat" rel="nofollow">https://wiki.roll20.net/API:Chat#Entering_API_Buttons_In_Chat</a>
1587432414
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
[Roll Damage](~Attack-Damage1) ...will work if it is an ability calling another ability on the same sheet. Check out the entry on&nbsp; Chat Menus , it lists the most common uses and gives the appropriate syntax. Here's the relevant portion, though: [command name](#macro to call) Default button syntax to reference a Macro in the collections tab—You probably don't need to use this for a Chat Menu. Use one of the versions below. If you use the macro character tip posted above, the format is: [command name](~macro to call) Button syntax to reference an&nbsp;Ability on the same sheet ... with "macro to call" being another ability on the same sheet. By keeping your macros on a sheet along with the Chat Menu macro itself, you not only gain the advantage of transportability to new campaigns, you also ensure that nothing breaks once you transport it. The macro it's calling comes right along with it. If you want to reference a macro that is on a character sheet (an "Ability"), but you are not writing the macro on the same sheet, you can reference the ability with this format (Assuming that your referenced sheet is called "Macros"): [command name](~Macros|macro to call) Button syntax to&nbsp;reference an Ability on&nbsp; another &nbsp;character sheet, such as a Macro Character Sheet. If your macro is a loose, global macro, the code is a little more arcane, since you need to use HTM replacements: [command name](!&amp;#13;#macro to call) Button syntax to&nbsp;reference a Macro in the collections tab. Try to use only in Abilities, not Macros, since Macros will revert the HTML replacement if you need to edit.
1587432608

Edited 1587432750
Tom
Pro
Sheet Author
Thanks guys. I had done this on a previous game a year ago, but with universal macros.&nbsp; Testing it out today, those don't work anymore either.&nbsp; So somewhere in the last two years, clearly something in the engine has changed. I'm hoping to link this to an Ability (not a character sheet function) that's tied to the character.&nbsp; I'm trying to build a monster template and this is just one of those hurdles. Thanks for all the help.&nbsp; Let me see if I can't make it work now. Edit: GiGi, I tried your suggestion and get the following: No ability was found for %{-M5Nzhrsady9NjM9Rc-a|! %{Attack-Damage1} TypeError: Cannot read property 'substring' of undefined
1587432898
Tom
Pro
Sheet Author
Keith Curtis, I'm trying to call an Ability, but not one that is baked into the character sheet per se. For perspective:
1587434267

Edited 1587434413
GiGs
Pro
Sheet Author
API Scripter
The syntax I posted should work if its an Ability on a character sheet. But I''m not sure your error message matches my syntax, are you sure you copied it exactly? Did you try just pasting it into chat? Also, because it uses html entities, if you put it in a macro, then reopen the macro, it will break. So once you save it, dont reopen it.
1587435134
Tom
Pro
Sheet Author
See for yourself.&nbsp; No, I didn't try pasting it into the chat field. &gt; Also, because it uses html entities, if you put it in a macro, then reopen the macro, it will break. So once you save it, dont reopen it. Oh.&nbsp; Crap.&nbsp; Well...
1587435425

Edited 1587435454
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Tom said: Keith Curtis, I'm trying to call an Ability, but not one that is baked into the character sheet per se. For perspective: &lt;image&gt; Try: [command name](~Adversary Template|Action:Attack1) Although, I would recommend renaming the ability to Action-Attack1. I don't know if a colon is problematic, but why take chances?
1587437407
Tom
Pro
Sheet Author
Keith, That did it!&nbsp; Is it possible to change Adversary Template to @{selected|token_name} or something similar?&nbsp; I'm trying minimize the tinkering required after its done.