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

distanceToPixels function?

The  Use Guide page on the wiki mentions the distanceToPixels utility function in a couple places. However, that function doesn't seem to exist. (I get the following error from the API when attempting to call it - ReferenceError: distanceToPixels is not defined) Is the Wiki page outdated, or is this a function planned for the future, or what's the deal?
1472049820
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I think it was planned to be implemented at some point, but was eventually forgotten. It used to be on the Utility Functions section too, but was removed from there. You could easily implement the behavior for distanceToPixels yourself: (Should work, but not tested) function distanceToPixels(dist) { var PIX_PER_UNIT = 70; var page = getObj('page', Campaign().get('playerpageid')); return PIX_PER_UNIT * (dist/page.get('scale_number')); }
Gotcha. That works perfectly, thanks.