Brian said: on('chat:message', function(msg) {
if (msg.type === 'whisper' && msg.who.indexOf('->') === -1) { if (playerIsGM(msg.playerid)) return; // Don't echo whispers sent by a GM var target = findObjs({ type: 'player', displayname: msg.target_name })[0]; if (target && playerIsGM(target.id)) return; // Don't echo whispers originally sent to a GM
var name = 'Whisper: ' + msg.who + ' -> ' + msg.target_name;
sendChat(name, '/w gm ' + msg.content);
}
}); Should work. Actually, /w gm might produce a target_name of "gm". I haven't checked. If that's the case, you'd need this instead: on('chat:message', function(msg) {
if (msg.type === 'whisper' && msg.who.indexOf('->') === -1) {
if (playerIsGM(msg.playerid)) return; // Don't echo whispers sent by a GM
var target = findObjs({ type: 'player', displayname: msg.target_name })[0];
if (target && playerIsGM(target.id)) return; // Don't echo whispers originally sent to a GM by name if (!target && toLowerCase(msg.target_name) === 'gm') return; // Don't echo whispers in the form /w gm
var name = 'Whisper: ' + msg.who + ' -> ' + msg.target_name;
sendChat(name, '/w gm ' + msg.content);
}
}); 1st one is giving me echo whispers, 2nd one is giving me this error : /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1
orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v
^
ReferenceError: toLowerCase is not defined
at evalmachine. :3485:24
at eval ( What would be the fix for this? If you just want to post correction code and what line it goes on I can put it there, just not too sure how to fix. Just starting to learn JavaScript language and not familiar with how to debug yet.