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

How to use (selected) AND (target) in the same Macro?

Hello i have a small macro that: 1- calculate the recoil of the weapons of a character (and store it in an Attribut) 2- place a status token on a target (to show a debuff) So i use both selected and target in the macro, but the "selected" part is not working, it is fine if i use it alone. Is there a way to prioritize the operations? !setattr --sel --silent --mod --recoil_value|[[{[[3-ceil(1+@{selected|primary_range_weapon_recoil}+(@{selected|body}/3))]],0}kh1]] !token-mod --set statusmarkers|broken-shield:+2 --ids @{target|token_id}
1581520235
GiGs
Pro
Sheet Author
API Scripter
There's a problem when using selected and target together, that the context of the selected token is lost when you use target. You can probably get around this by using then muti-targetting syntax, like so !setattr --sel --silent --mod --recoil_value|[[{[[3-ceil(1+@{target|me|primary_range_weapon_recoil}+(@{target|me|body}/3))]],0}kh1]] !token-mod --set statusmarkers|broken-shield:+2 --ids @{target|enemy|token_id} This should (if I've remembered the syntax correctly) prompt you to target twice - first target your own token, then target the other token. It's not important what you add for the target name, just that each is unique. 
Thanks a lot!