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 an API from a MACRO

Hi guys, I am having a little trouble with the AMMO API, it works great via the chat and a simple macro, but I wanted to call the API from a more complex MACRO and I having bad results, so the scenario is as follows: 1. I installed the AMMO API and it is working fine, no issues via chat or using a simple macro: !ammo @{selected|character_id} arrows -1 2. I have another macro that I use for range attacks: &{template:DnD35Attack} {{pcflag=true}} {{name=@{selected|character_name}}} {{subtags=Ataca al maligno desde lejos con un @{selected|weapon2name} }} {{attack1= Para lograrlo necesitas un AC ?{AC Maligno|10} o mayor y sacaste un [[ 1d20cs>19 + ?{Modificador|0} + [[ @{selected|rangedattackbonus} ]] ]] }} 3. If I try to call the Arrows simple macro with #Arrows, in the chat the following message is showing: Darian Ataca al maligno desde lejos con un Light crossbow Para lograrlo necesitas un AC 10 o mayor y sacaste un 8 !ammo -KR_7ikcBT1S82pNWCOl arrows -1 4. Sorry about the Spanish  5. As you can see, in bold, that is the result when I try to call the #Arrows within the complex macro and the API is not working like that. Can someone please help me? Thanks, Moises H.
1476131878
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmmm, weird, I use !ammo inside a complex macro on the pathfinder sheet. Try moving the !ammo call inside the attack macro itself: &{template:DnD35Attack} {{pcflag=true}} {{name=@{selected|character_name}}} {{subtags=Ataca al maligno desde lejos con un @{selected|weapon2name} }} {{attack1= Para lograrlo necesitas un AC ?{AC Maligno|10} o mayor y sacaste un [[ 1d20cs>19 + ?{Modificador|0} + [[ @{selected|rangedattackbonus} ]] ]] }} !ammo @{selected|character_name} arrows -1 Not sure why that should improve it, but that is how I call it for the gunwielding magus that one of my players plays.
1476131960
The Aaron
Pro
API Scripter
Hmm... I've never tried to call ammo from a macro via a macro.  Try just placing the  !ammo @{selected|character_id} arrows -1 line in your macro where you were putting #Arrows and see if that works
Thanks guys, I tried both options and still getting the same result :(
1476134005
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What is the exact text of the attack macro that you were trying (both your previous macro in a macro version, and the version that Aaron and I suggested.
This is the macro programming I am using today without any change and it works: &{template:DnD35Attack} {{pcflag=true}} {{name=@{selected|character_name}}} {{subtags=Ataca al maligno desde lejos con un @{selected|weapon2name} }} {{attack1= Para lograrlo necesitas un AC ?{AC Maligno|10} o mayor y sacaste un [[ 1d20cs>19 + ?{Modificador|0} + [[ @{selected|rangedattackbonus} ]] ]] }} And the below is the macro modified with the AMMO API call: &{template:DnD35Attack} {{pcflag=true}} {{name=@{selected|character_name}}} {{subtags=Ataca al maligno desde lejos con un @{selected|weapon2name} }} {{attack1= Para lograrlo necesitas un AC ?{AC Maligno|10} o mayor y sacaste un [[ 1d20cs>19 + ?{Modificador|0} + [[ @{selected|rangedattackbonus} ]] ]] #Arrows }} Thanks.
1476134504

Edited 1476134547
The Aaron
Pro
API Scripter
Move the #Arrows outside the closing }} and put it on it's own line. &{template:DnD35Attack} {{pcflag=true}} {{name=@{selected|character_name}}} {{subtags=Ataca al maligno desde lejos con un @{selected|weapon2name} }} {{attack1= Para lograrlo necesitas un AC ?{AC Maligno|10} o mayor y sacaste un [[ 1d20cs>19 + ?{Modificador|0} + [[ @{selected|rangedattackbonus} ]] ]] }} #Arrows
1476135650

Edited 1476135726
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, that's what I thought the issue was, if it still doesn't work, replace #Arrows in Aaron's example with the actual API command (still on it's own line) as seen in  my post above .
OMG, it worked, thanks The Aaron!!!
Thanks Scott C for your time and patience!
1476135781
The Aaron
Pro
API Scripter
No worries.  Happy Rolling!