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

Calling templates (in a macro) from another macro using Ability Command Buttons...

I can't seem to get the syntax right, and it's been driving me mad for weeks. I really want to make this work. Is it possible?

Here is the macro (I've tried replacing the characters like } | and ,  but I can't seem to figure out which ones actually need it):

/w @{selected|character_name} &{template:default} {{name=Ammunition}} {{@{selected|character_name} currently has @{selected|Var_setup}rangedweaponname@{selected|Ranged_equipped}} equipped, with [[@{Selected|Var_setup}Ranged_@{Selected|Ranged_ammo_carrier}}]] / @{Selected|Var_setup}Ranged_@{Selected|Ranged_ammo_carrier}|max} @{selected|Ranged_ammo_type} in the @{selected|Ranged_ammo_carrier}, and a total of @{selected|Var_setup}Ranged_total_@{Selected|Ranged_ammo_type}} stored in their backpack.

[Ammunition in inventory](!

#Ranged_Ammo_Storage) [Increase/Decease Arrows](!

#Ranged_Ammo_Change) 

}}

September 18 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I assume Ranged_Ammo_Storage is a universal macro?

If so, that should look like

[Ammunition in inventory](!
#Ranged_Ammo_Storage) [Increase/Decease Arrows](!
#Ranged_Ammo_Change) 

Try it on its own, entering it in chat without the rest of the roll template.

If they are abilities on a character sheet, and not universal macros, the syntax is different:

[Ammunition in inventory](!
%{selected|Ranged_Ammo_Storage}) [Increase/Decease Arrows](!
%{selected|Ranged_Ammo_Change}) 

Also, if you are saving your macro in the macros tab, be aware that every time you open it, the html entities will be replaced. The bits that look like



will be effectively replaced, breaking your macro. So once you have them set up, dont reopen them (or keep a safe copy), 

I'll test that out, but the macros referenced within the macro I posted execute without issue. It is when I click the Ability Command buttons from another macro. I'll post it below. Some of the macros get launched without issue, some halfway work.

The macro for this menu is (Check Quiver is what calls the macro I originally inquired about. All of them work fine (other than the template for Shoot), but Check quiver doesn't even launch when used from this Ability Button):

/w @{selected|character_name} &{template:default} {{name=Ranged Management}} {{

[Shoot](! #Ranged_Shoot) [Dry Shoot](! #Ranged_dryfire) 

[Check @{selected|Ranged_ammo_carrier}](! #Ranged_Ammo_Check) [Equip](! #Ranged_Equip) 

[Reload](! #Ranged_Reload) [+/- Ammo](! #Ranged_Ammo_Decrease)

}}

September 18 (5 years ago)

Edited September 18 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

If some of them work, and some of them don't, you'd need to examine the code of the ones that don't work. There's an error in that code.

What is the text of the ranged_ammo_check macro? It sounds like you are running afoul of the html replacement issue described here:

https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries

But using buttons normally avoids that. Does your macro include any characters that would trigger this issue?

Yep, I figured it has to do with the character replacement, but I was focusing on the wrong macro. I figured that since some of the macros were able to be called from the Ability Command buttons, that it was an issue with the called macros. Nope! Your original response solved the problem immediately, and fixed the other buttons that only had partial functionality! Now I see why the spaces in front of macros in Ability Command buttons are replaced!

You have been an immense help. I figured it was something stupid simple I was omitting, a fresh set of eyes was the answer. Thank you so much! My ranged players will be thanking you.  ^_-

September 18 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

That's great to hear, thanks :)