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

Marketplace Assets in API Scripts

I'm trying to use the DungeonDraw API script. I paid for the assets in the marketplace. I have the assets in my library. Recently, something happened, and I found myself needing to reinstall the API scripts, including re-entering the image URLs.  When I inspect them, all the URLs are marketplace URLs, and I can't use them in the API script because it spits the error  You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info Can we please make this easier? I'm on the brink of canceling my subscription; this is the only reason I'm using Roll20. 
1527217313

Edited 1527217480
Gold
Forum Champion
Hi Cory! Fair question. People in the forum community, quite possibly including the Dungeon Draw artist and API script author, Stephen S, will come by this thread to assist, given time. API Scripts are mostly community-created, as this one is, not a product of the Roll20 Devs. Trouble-shooting them is often up to the Script author and users. Roll20 makes efforts to ensure that Marketplace products are fully compatible, but sometimes the script may need to be Updated for various reasons. Or there may be another way to reset your URL's to point to the ones from your Library (not the URL's from the Marketplace). As far as not allowing the API to link to the Marketplace images, this is for security of the Marketplace, and is a Requested feature in the Suggestions to add the ability to link there into the API. For now the good news is that Scripts ARE able to link to images from your personal Library (Uploads). As you've said the images are Uploaded to your Library, the solution to this probably involves getting those links to point at the Library version you have on-hand.&nbsp; If not that, then maybe some other script update, fix, or workaround will come along. You may want to try contacting the publisher directly through Stephen's Publisher page in Marketplace or ask by email <a href="mailto:team@roll20.net" rel="nofollow">team@roll20.net</a> if you require direct assistance on account/refund request. Links and Wiki to help, <a href="https://marketplace.roll20.net/browse/publisher/50" rel="nofollow">https://marketplace.roll20.net/browse/publisher/50</a>... <a href="https://app.roll20.net/users/135636/stephen-s" rel="nofollow">https://app.roll20.net/users/135636/stephen-s</a> <a href="https://wiki.roll20.net/Dungeon_Draw_API" rel="nofollow">https://wiki.roll20.net/Dungeon_Draw_API</a>
1527222046
The Aaron
Pro
API Scripter
Stephen S. and I spent many hours trying to come up with a way to make that easier.&nbsp; Unfortunately, there really wasn't anything practical.&nbsp; The best I can offer you is a script that will make it easier to get the User Library image url. Drag images in from your library and select one or more of them and run this command: !user-image This will show an image of each graphic with the URL for that graphic, if it is in a User Library. Here's the script: on('ready',function(){ &nbsp; &nbsp; 'use strict'; &nbsp; &nbsp; var getCleanImgsrc = function (imgsrc) { &nbsp; &nbsp; &nbsp; &nbsp;var parts = imgsrc.match(/(.*\/images\/.*)(thumb|med|original|max)(.*)$/); &nbsp; &nbsp; &nbsp; &nbsp;if(parts) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return parts[1]+'thumb'+parts[3]; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;return; &nbsp; &nbsp; }; &nbsp; &nbsp; on('chat:message',function(msg){ &nbsp; &nbsp; &nbsp; &nbsp; if('api' === msg.type && msg.content.match(/^!user-image/) && playerIsGM(msg.playerid) ){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let who=getObj('player',msg.playerid).get('_displayname'), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output = _.chain(msg.selected) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .map( s =&gt; getObj('graphic',s._id)) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reject(_.isUndefined) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .map( o =&gt; o.get('imgsrc') ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .map( getCleanImgsrc ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reject(_.isUndefined) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .map(u =&gt; `&lt;div&gt;&lt;img src="${u}" style="max-width: 3em;max-height: 3em;border:1px solid #333; background-color: #999; border-radius: .2em;"&gt;&lt;code&gt;${u}&lt;/code&gt;&lt;/div&gt;`) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .value() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .join('') || `&lt;span style="color: #aa3333; font-weight:bold;"&gt;No selected tokens have images in a user library.&lt;/span&gt;` &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat('UserImage',`/w "${who}" &lt;div&gt;${output}&lt;/div&gt;`); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; }); });