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

[PF Sheet related] Including an "attacks-macro" button in API generated chat message

1472679502

Edited 1472679515
I have a TokenAction macro "@{selected|attacks-macro}", that will display the output from the "All Attacks" button on the sheet.  But, now I want to have a menu of action buttons whispered to a player on their tokens turn, including things like the "All Attacks" button, but I can not get it to work when trying to include a button for "attacks-macro". As part of troubleshooting I have hard coded a Character ID and it works if I reference something like an attack roll with the code below: var actionButtons = `{{[Attacks](~-KIjpzaT3NPTMhRgp1LF|repeating_weapon_-kiju5i0kpp5k0noyji7_attack-roll)}}`; var actionTemplate = `&{template:pf_generic} @{${charName}|toggle_rounded_flag}{{color=@{${charName}|rolltemplate_color}}} {{header_image=@{${charName}|header_image-pf_generic}}} {{character_name=@{${charName}|character_name}}} {{character_id=@{${charName}|character_id}}} {{subtitle}} {{name=Actions}} ${actionButtons}` var actionBox = `<div style='border: 3px solid #808080; background-color: ${bgColor}; padding: 1px 1px;'> ${actionTemplate} <div style="clear:both;"></div></div>`; sendChat('', `/w "${charName}" ${actionBox}`); I get the pf_generic template whispered to the player with an "Attacks" button. When I click on the attack button it makes the repeating_weapon attack roll as expected. Now, if I change the "repeating_weapon_-kiju5i0kpp5k0noyji7_attack-roll" to "attacks-macro" as seen in the code below (first line): var actionButtons = `{{[Attacks](~-KIjpzaT3NPTMhRgp1LF|attacks-macro)}}`; var actionTemplate = `&{template:pf_generic} @{${charName}|toggle_rounded_flag}{{color=@{${charName}|rolltemplate_color}}} {{header_image=@{${charName}|header_image-pf_generic}}} {{character_name=@{${charName}|character_name}}} {{character_id=@{${charName}|character_id}}} {{subtitle}} {{name=Actions}} ${actionButtons}` var actionBox = `<div style='border: 3px solid #808080; background-color: ${bgColor}; padding: 1px 1px;'> ${actionTemplate} <div style="clear:both;"></div></div>`; sendChat('', `/w "${charName}" ${actionBox}`); It doesn't work, instead I get the error message "No ability was found for %{-KIjpzaT3NPTMhRgp1LF|attacks-macro}". I'm guessing this is related sendChat docs which say "You cannot use macros.", but I'm confused why it works for the attack as I think that is also a macro (but I'm probably wrong). I thought maybe there was a way to get what I was trying to do to work with an API Command button, but I tried several permutations and was unsuccessful. So, two questions: 1.) Is there a way to do what I am trying to do?  2.) Why does the above work for something like the attack roll, but not the attacks-macro? Thanks! Joe
1472680460

Edited 1472680566
vÍnce
Pro
Sheet Author
Not sure if this is the problem, but you should be referencing @{attacks_buttons_macro} not @{attacks-macro}.  The @{attacks-macro} attribute is the value of @{attacks_buttons_macro} and is generated via sheet workers.
1472680501

Edited 1472680594
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The attack button macro is called attacks_buttons_macro not attacks-macro (at least according to the tooltip that pops up when you hover over it). I think I remember the sheet authors saying that attacks-macro is part of the html call to it or something. EDIT: Ninja'd by Vince, and yeah, that was what I was vaguely remembering. EDIT the 2nd: Although i think it should be referencing %{attacks_buttons_macro} not @{...}
1472680587
vÍnce
Pro
Sheet Author
lol
Well so it is, where did I get attacks_macro? and how the hell is my token action "@{selected|attacks-macro}" working? I'm now referring the correct thing and why what do you know, it works! Thanks guys!
1472681958
vÍnce
Pro
Sheet Author
Someone else posted something on the forums using @{attacks-macro} which does have data(generated by sheet workers based off of other sheet attributes), but it's not really what people want.  They really want the command buttons which is @{attacks_buttons_macro}.