Advertisement 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!