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

[!Measure] - Can it be called from a Macro?

July 17 (6 years ago)
Mike W.
Pro
Sheet Author

Using the !measure API script, is there a way it can be called from a macro after I have selected my primary token, then the macro tells me to select my Target token, then it shows the distance from my Selected Token to my Targeted Token?

I am pretty good with Macros but have no idea how to do this.


July 17 (6 years ago)
The Aaron
Pro
API Scripter

Like this?:

!measure @{selected|token_id} @{target|token_id}
July 17 (6 years ago)
The Aaron
Pro
API Scripter

There's a bug with the API that means if you use @{target}, you can't rely on the tokens you have selected actually getting passed to the API script, you have have to either select them each with @{target}, or only have one selected initially which you can get the id for from @{selected} and @{target} the rest.

July 17 (6 years ago)
Mike W.
Pro
Sheet Author

Worked perfectly.

I have it as a Token macro so the First token is initially selected

July 17 (6 years ago)
The Aaron
Pro
API Scripter

Nice!