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

Pulling a random token from a table with a Macro

September 22 (8 years ago)
HDMR
Pro
Howdy!

I've got a table here that I'd like to drop a token on the tabletop, and randomise it according to the weight it's given. As it is now, I can hit the token button, and then right click and randomise it.  Is there a way to add this to a macro? I looked over the wiki, but haven't had any luck.

Thanks for the help.
September 22 (8 years ago)

Edited September 22 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Having this be macro triggered would require the API. I have seen a few scripts that do something similar. This post actually shows exactly what you want, but I don't know what script the poster is using; it's not standard TokenMod commands.

EDIT: here's the script: https://app.roll20.net/forum/post/2576603/script-change-token-image-from-rolltable/?pagenum=1
September 22 (8 years ago)
The Aaron
Pro
API Scripter
Note that the weights are not respected for Rollable Table Tokens. Their weight becomes effectively 1 each. 
September 22 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ah, did not know that
September 22 (8 years ago)
The Aaron
Pro
API Scripter
Yup. Reference: https://wiki.roll20.net/Card_Decks_and_Rollable_Ta...
September 22 (8 years ago)
HDMR
Pro

Scott C. said:

Having this be macro triggered would require the API. I have seen a few scripts that do something similar. This post actually shows exactly what you want, but I don't know what script the poster is using; it's not standard TokenMod commands.

EDIT: here's the script: https://app.roll20.net/forum/post/2576603/script-change-token-image-from-rolltable/?pagenum=1

Thanks, eh.  I knew I had seen something similar recently.

The Aaron said:
Yup. Reference: https://wiki.roll20.net/Card_Decks_and_Rollable_Ta...

I guess I'll have to go another route, I need them weights.

Thanks to you both for the help.
September 22 (8 years ago)
The Aaron
Pro
API Scripter
You could probably modify that script to random roll the token based on the weights in a specified table.
September 22 (8 years ago)
HDMR
Pro

The Aaron said:

You could probably modify that script to random roll the token based on the weights in a specified table.
I couldn't myself as I've no experience with scripts and their fiddley Jazz magic, and it's just a small project for myself. I can do the extra clicks. Thanks again, the help is always appreciated. 

September 22 (8 years ago)
It would be possible to make a table with multiples of certain images to achieve the weighted results. That's the way the table weights work anyway, this would just be done manually. So if you have want a weight of 2 you would add the entry twice. That should work.