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

Theoretical Script Question

1512678330
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Is there any way an API script could simulate a drag from the Compendium to a character sheet, or is that out of their touch? It seems like it would be a way to quickly distribute treasure. My suspicion is that it is either too finicky (where on the sheet are you dragging it to?) or just impossible (that part of the interface is unscriptable). But it was a passing thought...
1512680139
The Aaron
Pro
API Scripter
That's basically what the import scripts do, except that the API does not have access to the compendium, so they are generally driven off of javascript data files, or text pasted into chat or a token's GM Notes.
If I recall correctly, there is an intentional disconnect between the API and the compendium. But if you were to have a database built into the API, you could simulate a 'drop' by simply setting/creating the required attributes and using the appropriate sheet workers.
1512695797
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I suspected that it would work something like that. Re-entering all the SRD data would not be worth the effort. Oh well, drag and drop isn't that hard. :)
But that means that you could make a database of treasures etc and use an API to import directly to selected characters? Would take some time setting up, but might speed up the actual game. 
1512959606

Edited 1512963682
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I already do something similar to that for character classes not in the SRD—importing features from a database I created, via ChatSetAttr. This would have been something a bit more limited, but direct from information already available and formatted/parsed. Also, some sheets do extensive behind-the-scenes work when you drag in a Compendium item. My hope was that if a drag could be simulated, you could bypass worrying about all that.