Skip to content

Instantly share code, notes, and snippets.

@NoxMortem
Last active May 31, 2016 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NoxMortem/d420523a273bf0b3a86891b98ef4530a to your computer and use it in GitHub Desktop.
Save NoxMortem/d420523a273bf0b3a86891b98ef4530a to your computer and use it in GitHub Desktop.
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