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

[Help] Issues with imgsrc and the library

Ok, so been messing with this for a few hours now, I feel like I have everything down and that it should work but it just keeps giving me imgsrc errors. Basic idea is a way to create a carbon copy of a character. It copies the character journal (at least the important bits) and makes a new one named "Twin". After doing that it's supposed to duplicate the token on the map, but having poked around I can't find a quick command for the second one anywhere. So, I just tried to do a createObj({}); deal and put the new token on the map. API log and the Objects section of the API have informed me that all character tokens need to be in my library. So, I created local copies of all of the images, uploaded them, and created a whole new set of tokens for the party. The imgsrc of those tokens (as far as I know) should have a call to my local library, being there now. But now imgsrc throws the error that they need to be in thumb format, which I have no idea how to do. Here's the code I have (beautifully simple) var Twin = Twin || {}; on("chat:message", function (msg) { if (msg.type != "api"){return}; //log(msg.content); //If msg has inline rolls, convert them to integers. if(_.has(msg,'inlinerolls')){ msg.content = _.chain(msg.inlinerolls) .reduce(function(m,v,k){ m['$[['+k+']]']=v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },msg.content) .value(); }; //Convert msg.content into collable tags via chatObj.[Tag] (Ex. chatObj.target_id) var command = msg.content.split(" ", 1); var n = msg.content.split(" --"); var a = 1; var chatObj = {}; var mTags = ""; var mContent = ""; while(n[a]) { mTag = n[a].substring(0,n[a].indexOf("|")); mContent = n[a].substring(n[a].indexOf("|") + 1); chatObj[mTag] = mContent; a++; }; log(chatObj); if (command == "!twin") { var token = findObjs ({ _type: "graphic", _id: chatObj.id })[0]; //log(token); log(token.get("imgsrc")); //I kept looking it up so I wanted it handy in the log var target = findObjs({ _type: "character", name: token.get("name") })[0]; var target_id = target.get("_id"); //log(target); var attribute = findObjs({ _type: "attribute", _characterid: target_id }); //log(attribute); var ability = findObjs({ _type: "ability", _characterid: target_id }); //log(ability); //Create the character createObj("character", { name: "Twin", inplayerjournals: target.get("inplayerjournals"), controlledby: target.get("controlledby"), avatar: target.get("avatar") }); var twin = findObjs({ _type: "character", name: "Twin" })[0]; //log(twin); //Fill out the attributes for (var i = 0; i < attribute.length; i++) { createObj("attribute", { name: attribute[i].get("name"), current: attribute[i].get("current"), max: attribute[i].get("max"), _characterid: twin.id }); }; //Fill out the abilities for (var i = 0; i < ability.length; i++) { createObj("ability", { name: ability[i].get("name"), action: ability[i].get("action"), istokenaction: ability[i].get("istokenaction"), _characterid: twin.id }); }; //Create token createObj("graphic",{ _pageid: Campaign().get("playerpageid"), layer: token.get("layer"), imgsrc: token.get("imgsrc"), represents: twin.id, left: token.get("left"), top: token.get("top"), width: token.get("width"), height: token.get("height"), flipv: token.get("flipv"), name: "Twin", controlledby: token.get("controlledby"), showname: true, showplayersname: true, showplayers_bar3: true, light_radius: token.get("light_radius"), light_dimradius: token.get("light_dimradius"), light_showplayers: token.get("light_showplayers"), light_hassight: token.get("light_hassight"), light_angle: token.get("light_angle"), light_losangle: token.get("light_losangle"), light_multiplier: token.get("light_multiplier") }); }; }); Any ideas for a fix come to mind?
1426249886
The Aaron
Pro
API Scripter
You just need to replace max or med with thumb. Here's a good place to start: <a href="https://wiki.roll20.net/API:Cookbook#getCleanImgsr" rel="nofollow">https://wiki.roll20.net/API:Cookbook#getCleanImgsr</a>...