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

Simple question. unanswered. Create a token from my library.

I've been reading over the wiki for awhile and playing with the API but so far I've found no direct examples of this very basic thing. I just want to spawn an object from my own library of uploads to the currently open map. I see how to do createObj but I don't understand where the imgsrc comes from there is a weird outline talking about the database of images but no explainable of how to go from something in my library, to a usable reference to use here. So an example of just something from the local library of uploaded images being loaded in as a token, would be great! Thanks!
1488073514

Edited 1488074283
PaprikaCC
Pro
API Scripter
You can just drag an uploaded image onto the map to create a new token, there isn't a need to do that with a script. Can you give us a little more information about what you want to do? // Example createObj call createObj('graphic', { name: 'newToken', imgsrc: '<a href="https://s3.amazonaws.com/files.staging.d20.io/images/123456/thumb.png?12345678" rel="nofollow">https://s3.amazonaws.com/files.staging.d20.io/images/123456/thumb.png?12345678</a>', layer: 'objects', height: 70, width: 70, left: 350, top: 350 }); If you want to determine the 'imgsrc' property of you new token, you can find it if you open your library, find the image you want to use and get its location through 'Inspect Element' if you're using Chrome.
I'm working on a TSV loader for dungeons generated using&nbsp;<a href="https://donjon.bin.sh/pathfinder/dungeon/" rel="nofollow">https://donjon.bin.sh/pathfinder/dungeon/</a> I did figure out if I drag a token in its pretty easy to find the reference within the map but not a direct reference to the object in the library. inspecting elements is ugly as hell but I guess that works, no 'good' other method it seems.