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

Macro Variable Help

I was writing out a macro that includes variables from selected token, target token, and a third non set variable (distance). Is there a way to automatically input distance between tokens, or is there a way to manually plug it in every time? Thanks for the help.
1467164615
Silvyre
Forum Champion
M W. said: Is there a way to automatically input distance between tokens, or is there a way to manually plug it in every time? Unfortunately, it's not possible for a macro to calculate the distance between objects on the tabletop without the assistance of an API Script . (Access to the API is available in games in which the Creator has an active Pro subscription.)
You can manually ask for range with a roll query. I use the following snippet in my D&D 3.5 ranged weapon macros: - [[floor(?{Range (in feet) (Max range = @{selected|weapon1maxrange} ft)|0}/@{selected|weapon1range})*2]] [Range]