So just for the sake of it I was making a script to clone tokens from the Start page to my current page. Every time I ran my code I noticed only a few of the tokens got copied. This is the code I use to clone (pretty straight forward) var currentPageGraphics = findObjs({
_pageid: pageid,
_type: "graphic",
});
_.each(currentPageGraphics, function(obj) {
//Do something with obj, which is in the current page and is a graphic.
createObj("graphic", {
name: obj.get("name"),
controlledby: obj.get("controlledby"),
left: obj.get("left")+70,
top: obj.get("top"),
width: obj.get("width"),
height: obj.get("height"),
bar1_value: obj.get("bar1_value"),
bar1_max: obj.get("bar1_max"),
showname: true,
showplayers_name: true,
showplayers_bar1: true,
imgsrc: obj.get("imgsrc"),
pageid: obj.get("pageid"),
layer: "objects"
});
})
}
The script screen made it pretty clear why. "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." After debugging a bit i found out that some of the tokens had a imgsrc with the max version of the image (eg. <a href="https://s3.amazonaws.com/files.d20.io/marketplace/5936/5F9eAvsLWF5GugRVkVH7Jg/max.png?1340053216" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/5936/5F9eAvsLWF5GugRVkVH7Jg/max.png?1340053216</a> ) According to the API doc I should be using the thumb and the tokens that were getting copied all had the thumb.png version of the image. So I tried running a simple test. imgsrc: obj.get("imgsrc").replace("max", "thumb"), I debugged the result of this replace and it is the valid link to the thumb version of that image. But I still encounter the same error message. So now I am a bit lost on what else I could be trying since the final imgsrc that I am adding is a valid one and it appears to follow all the rules stated at the API doc.