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

Nested Macro Help - Adding TokenMod to Spell Macro

I am trying to add a Token-Mod macro to my Healing Spell Attack Macros to apply the healing amount to the selected target.  But I keep running into errors, I think from the nested macro. The Healing Spell Macro: @{Elran|wtype}&{template:atkdmg} {{mod=-}} {{rname=Healing Word}} {{r1=[[0d20cs>20]]}} {{r2=[[0d20cs>20]]}} 0 {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[?{Cast at what level?|1st Level,1|2nd Level,2|3rd Level,3|4th Level,4|5th Level,5|6th Level,6|7th Level,7}d4+[[[[[[?{Cast at what level?}]]d1]]+2]][DISCIPLE OF LIFE] + 5[WIS]]]}} {{dmg1type=Healing}} {{damage=1}} {{dmg2flag=1}} {{dmg2=[[[[[[?{Cast at what level?}]]d1+2]][BLESSED HEALER]]]}} {{dmg2type=Self Heal}} {{crit1=[[?{Cast at what level?|1st Level,1|2nd Level,2|3rd Level,3|4th Level,4|5th Level,5|6th Level,6|7th Level,7}d4+[[[[[[?{Cast at what level?}]]d1]]+2]][DISCIPLE OF LIFE][CRIT]]]}} {{crit2=[[[[[[?{Cast at what level?}]]d1+2]][BLESSED HEALER][CRIT]]]}} 0 {{desc=Target is healed for $[[9]] and Elran is healed for $[[7]]. [**+ Apply Healing**](`#Heal-Target)}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Elran|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Elran|global_damage_mod_type}}} ammo= @{Elran|charname_output} The Heal-Target Macro: !token-mod --ids @{target|1|token_id} --set bar1_value|[[{@{target|1|bar1|max},[[@{target|1|bar1}+$[[9]]]]}kl1]] The Heal-Target macro works if used independently (changing $[[9]] to a number for testing).  And the [**+ Apply Healing**](`#Heal-Target) in the {{desc=}} section of the Healing Spell puts the text and the link, but nothing happens when clicking the link (no target selection, etc). I tried character replacement in the Heal-Target Macro but that didn't see to do anything. What am I missing?  This method worked for adding links to Divine Smite and Hunter's Mark macros in the description of a weapon attack.  But something about this Token-mod macro isn't working when linked within the spell attack description. 
1625787203
The Aaron
Roll20 Production Team
API Scripter
At a minimum, you can simplify the TokenMod call to this: !token-mod --ids @{target|1|token_id} --set bar1_value|+$[[9]]! The + will add it to the current bar1_value, and the ! will keep it from going over the bar1_max. $[[9]] won't have a value by the time you run that macro.  You'll probably need to put it in as something like: [**+ Apply Healing**](!token-mod --ids @{target|token_id} --set bar1_value|+$[[9]]!) That will give you a button, and the { will prevent the @{target|token_id} from expanding before someone clicks the button.
Thanks Aaron!  Getting closer.  I like the simplified syntax and easier to just include directly into the roll macro.  However, the $[[9]] is expanded out from the value to the full roll explanation (inline roll blah blah blah).  I'll keep playing with it, but you got me one step closer.  Thanks.  
tysm
1625803878
The Aaron
Roll20 Production Team
API Scripter
Ah yes, I just tested and the $[[9]] doesn't get expanded when it's inside the button.  I think the only thing you could do is move the roll to that spot, rather than use the $[[9]].  That should get expanded correctly and also replaced correctly, though I can't be completely sure.