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

Question: Targeting an empty location and/or map hex

Question: Do you know if there is a command similar to @{target} or ?{ } that will prompt the user to click, not on a specific token, but rather on any point on the map? (Returning either the (x,y) coordinates of the click, or, perhaps to select a specific hex (or square) on the grid?)
1402589550
Lithl
Pro
Sheet Author
API Scripter
There is not.
Aww. Thanks though! : )
1402687322
The Aaron
Roll20 Production Team
API Scripter
Depending on what you are doing, a work around might be to have your script create a token, like a crosshair, give control of it to the player triggering the action, let them move it to the right place, then click a token macro on the token to finish the action.
You could also let the user manually enter coords relative to a token, so something like !action @{target|token_id} 5 6
Aaron C. M. said: Depending on what you are doing, a work around might be to have your script create a token, like a crosshair, give control of it to the player triggering the action, let them move it to the right place, then click a token macro on the token to finish the action. I think the better idea would be to have the reticule already in play and have the players move it around. This is the solution I have been using for players the want to cast spells at empty locations.
Aaron C. M. said: Depending on what you are doing, a work around might be to have your script create a token, like a crosshair, give control of it to the player triggering the action, let them move it to the right place, then click a token macro on the token to finish the action. Yes! I think that is what I will do! Awesome suggestion.
If I call createObj in the API to create a token this way, can I then "destroy" the token when I am done with it to "free up the memory"? Is there an API call for deletion of an object, or does it need to be done from the game interface?
1402757034
Lithl
Pro
Sheet Author
API Scripter
The API cannot delete objects at this time, no.
1402775752
The Aaron
Roll20 Production Team
API Scripter
There is discussion on another post about pooling tokens that you have created and reusing them later instead of creating new ones, generally by moving them to an out of way place on the GM layer.
1402778912
The Aaron
Roll20 Production Team
API Scripter
Here's that discussion: <a href="https://app.roll20.net/forum/post/722044/delete-ob" rel="nofollow">https://app.roll20.net/forum/post/722044/delete-ob</a>...