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 .
×

Randomly extract one token present on the map: how can I do this?

1702912416

Edited 1702912514
Hello, I'm a pro user with a bit of experience on real life programming (I'm not experienced in javascript but it's not relevant) .... how can I randomly select a unit in the battlefiled? I need a rollable table with adjustable size since unit are also eliminated and inserted in the battlefield.... I think the best way to do this is using API: how can I obtain a list of the tokens present in a map?
1702912932
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What do you want to do with that random token?
Simply print is name/ID on the chat in oder to use it. You can think about this as an alternative way to determine initiative.
1702913417
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yeah, API is going to be your best bet there.
The  TokenFate script  does just that - randomly chooses a single token from a group of selected tokens.   
Thank you very much!