If you're talking about actually writing a JavaScript API script, it is as simple as: on('ready',function(){
"use strict";
var getCleanImgsrc = function (imgsrc) {
var parts = imgsrc.match(/(.*\/images\/.*)(thumb|med|original|max)(.*)$/);
if(parts) {
return parts[1]+'thumb'+parts[3];
}
return;
},
deadImg=getCleanImgsrc(' <some img URL in a user library> ');
if(deadImg) {
on('chat:message',function(msg){
if('api'===msg.type && msg.content.match(/^!kill\b/) ){
_.chain(msg.selected)
.map(function(o){
return getObj('graphic',o._id);
})
.reject(_.isUndefined)
.each(function (o) {
o.set({imgsrc: deadImg});
});
}
});
} else {
sendChat('Kill Script','/w gm <div style="background:red;font-weight:bold;color:white;border:2px solid white; padding .3em;">Your deadImg url is not in a user library.</div>');
}
});
I wrote this on my phone, so some gentle debugging might be necessary. =D Edit: Still might need some debugging, but I adjusted it again... =D Be sure to replace the highlighted part with your image url.