Perhaps so... =D !check <attribute name> <attribute name> ... Will tell you each character that is missing one of those attributes (and which one they are missing). It will also tell you if any of the characters have duplicates of one of those attributes (and how many duplicates there are), where duplicates mean the same name but different captialization: e.g. Speed speed SPEED sPeEd Script: on('ready',function(){
"use strict";
on('chat:message',function(msg){
var cmd,chars;
if('api' !== msg.type || !playerIsGM(msg.playerid) ){
return;
}
cmd = msg.content.split(/\s+/);
switch(cmd.shift()){
case '!check':
cmd = _.map(cmd,function(n){ return n.toLowerCase();});
chars=_.reduce(findObjs({type: 'character'}),function(m,c){
m[c.id]={
name: c.get('name'),
attrs: cmd,
dups: {}
};
return m;
},{});
_.each(filterObjs(function(o){
return 'attribute' === o.get('type') && _.contains(cmd,o.get('name').toLowerCase());
}),function(a){
var cid=a.get('characterid'),
aname=a.get('name').toLowerCase();
if(chars[cid]){
if(_.contains(chars[cid].attrs,aname)){
chars[cid].attrs=_.without(chars[cid].attrs,aname);
} else {
if(_.has(chars[cid].dups,aname)){
++chars[cid].dups[aname];
} else {
chars[cid].dups[aname]=2;
}
}
}
});
sendChat('','/w gm <h3>Attribute Check</h3>'+_.reduce(chars,function(m,c){
var line='';
if(c.attrs.length || _.keys(c.dups).length){
line+='<div><div style="font-weight:bold;">'+c.name+'</div>';
_.each(c.attrs,function(a){
line+='<div style="color: #900;padding-left:3em;"><b>Missing:</b> '+a+'</div>';
});
_.each(c.dups,function(c,n){
line+='<div style="color: #909;padding-left:3em;"><b>Duplicate:</b> '+n+' x '+c+'</div>';
});
line+='</div>';
m.push(line);
}
return m;
},[]).join('')
);
break;
}
});
});