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

Converting hex grid label to X,Y for sendPing()

Ahoy! As part of my twitch chat to roll20 work, I'm letting viewers "ping" on the map with the sendPing() API. This works fantastic! Currently the viewer can specify X,Y or a token's name. I'd also like to let them specify the grid label (eg. N10) but my maps are using horizontal hex and the math is boggling my mind. Does anyone have a clever algorithm for calculating the center of the hexes? Thanks all!
After some searching, I think I have a handle on how to do this. I'll post code when it's working. Thanks for pointers on discord, really appreciated!