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
This post has been closed. You can still view previous posts, but you can't post any new replies.

API (or macro) access to the existing grid system (mostly for hex)

January 27 (9 years ago)

Edited January 27 (9 years ago)
CURRENTLY
Using the UI, players can drag-and-drop tokens and they will (by default) snap to the cells on the map grid.
The UI can label these cells automatically (I refer to this as the cell's "address" below)
This this is independent of scale, units, or type (hexH, hexV, or square)

PROBLEMS
Roll20 Hex Math is Hard.
  • The existing distance between hex "centers" isn't 70.
  • The distance between hex centers is different in two of the directions compared to the third.
  • The distances between hex centers are different in H and V modes.
  • These distances aren't nice, whole, rational, counting numbers.  Not even close.
That's 4 different "distance" values that need to be tracked (in addition to 70 for squares), two for HexH, two for HexV.  Since they're not nice numbers, there is an error introduced that compounds over range.

DESIRED
I would like to be able to utilize the existing UI grid system from the API (or macro) to be able to:
  • retrieve a token's current cell address, or nearest cell if not snapped
  • move and snap a token to a specific cell using the cell address
Optionally, I would also like to be able to (in order of desire):
  • find the number of cells between two tokens.
    • squares are easy, and should be based on the map setting (either Manhattan or 4e, Euclidean and Pathfinder wouldn't apply in this case)
    • hexes are pretty much always Manhattan style
  • obtain a list of cells the token occupies if it is a "large" token - fully or partially would be two options
  • rotate a token to face a given cell face (4 choices for square, 6 for hexes)
    • this brings up the question of which direction a token is facing in the first place
  • be able to "drive" a token forward one cell (move and snap to the adjacent cell)
    • this also brings up the question of which direction a token is facing in the first place

ASSUMPTIONS
Obviously, in order for these cell addresses to be of any value, snap-to-grid should be enabled on the map.


February 02 (9 years ago)
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I made a hex mapping script at one point. 

I think there also a typo in one of the property setting for Roll20 as well for when it came to hexs.
February 14 (6 years ago)
[Deleted]
Pro
Marketplace Creator

Thanks for the suggestion!

After 30 days, Suggestions and Ideas with fewer than 10 votes are closed and the votes are refunded to promote freshness.

Your suggestion didn't build the right momentum this time, but feel free to submit it again! We find that the best suggestions describe the problem you are having, and the solution you want. You can learn more about the process of making suggestions on the Roll20 Wiki! More details can be found here.