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

SheetWorker event wildcard

Hey everyone! I was wondering, if sheetworker events support wildcards like on("change:skill_*",...) or some similar behaviour. I've read UniversalSheetWorker article and it is not quite what I'm looking for, since I have a list of a hundred skills and it would be painful (and ugly) to incorporate them all into universal list approach.  Alternatively, I thought about redefining on() function to support wildcards or making some kind of wrapper over it. Is it even possible? I couldn't find any documentation on the internals of script sandbox (I assume sheetworkers run there too, since I couldn't find any mention of them on client-side). The ultimate solution would be to implement my own event listener and that wouldn't be a problem if I knew where the events are coming from.  I'm not hands-on familiar with js but have programming background. 
1564280063
The Aaron
Roll20 Production Team
API Scripter
It doesn't support wildcards. You'd could create your own wrapper for it that would support wildcards, but you'd need to have a list of attributes and such to filter for the right events to register. The sheet workers run in a client side sandbox, so you're limited on what you'll be able to accomplish with creating an alternative event system. 
Thanks Aaron. Follow up question - can I register an event listener without specifying attribute? Something like on("change",...) so that I can process any change event the way I like. 
1564324888
The Aaron
Roll20 Production Team
API Scripter
Not that I have ever seen.
1564328077
GiGs
Pro
Sheet Author
API Scripter
Whatever approach you take, with the limitations of roll20 you have to start off by supplying a hardcoded list of attributes. There's simply no way around it. The Universal Sheet Worker approach, or something like it, is the closest we can get to wildcards.  If you have a list of 100 skills, but each of them follows the same rules, just with different names, a universal sheet worker will be pretty easy. An array or object of 100 items doesnt take much work - and definitely way less than it took to make the html for those attributes.