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

[Draft Script] Detects when a token is created by a table's "token" button and which table(s) its from.

1678925230
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://gist.github.com/BaldarSilveraxe/e72614a969ba536221d99890026d3556" rel="nofollow">https://gist.github.com/BaldarSilveraxe/e72614a969ba536221d99890026d3556</a> Could be used for lots of things, but not sure if any of them are worthwhile things.&nbsp; Like... pressing it gives you five random guards from the table. Or all the decorations for a room type.&nbsp; You could make the first item a transparent PNG and when detected it puts the random token from the rest of list on the GM layer.&nbsp; Basically, it makes the table's "token" button more useful for the API.&nbsp;
1678929718
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
obj.set({ represents: findObjs({type: 'character', name: getObj("rollabletable", tables[0]).get("name")})[0].id, imgsrc: getCleanImgsrc(decodeURIComponent(token.sides.split("|")[Math.floor(Math.random()*token.sides.split("|").length)])) }); This will relate a random token from a table to character sheet of the same name. So, one click gets you a random "commoner" token.&nbsp;