Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var cleanUp = function(){
var attributes_of_deleted = findObjs({type:'attribute'});
var abilities_of_deleted = findObjs({type:'ability'});
//log("#Attributes after delete: "+attributes_of_deleted.length);
var count = 0;
log("LIST trash attributes");
for(var attr in attributes_of_deleted){
attr = attributes_of_deleted[attr];
var chr = findObjs({type:'character',id:attr.get('characterid')});
if(chr.length == 0){
log(attr);
count++;
//attr.remove();
}
}
log("LIST trash abilities");
for(var abil in abilities_of_deleted){
abil = abilities_of_deleted[abil];
var chr = findObjs({type:'character',id:abil.get('characterid')});
if(chr.length == 0){
log(attr);
count++;
//abil.remove();
}
}
log("TOTAL:"+count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment