checkOwnerName = function(players,ownerId) { var whoToTest = _.where(players, {id: ownerId})[0].get('displayname').split(' ')[0]; return _.chain(players).map(function(p){ return p.get('displayname').split(' ')[0]; }).filter(function(n){ return n === whoToTest; }).value().length === 1; }, refreshData = function() {
var players = findObjs({type: 'player'}), ownerId = _.find(_.pluck(players,'id'),playerIsGM); if ( undefined === ownerId ){ chatOutput.Input({ action: 'alert', type: 'Halt', text: '<b>Script Halted.</b> Script halted. State failed to initialize due to <b>no GM</b> being found.' }); } if( !checkOwnerName(players,ownerId) ) { chatOutput.Input({ action: 'alert', type: 'Halt', text: '<b>Script Halted.</b> Script halted. State failed to initialize due to <b>GMs not having unique names.<b>' }); } //more stuff },