Hey, Im having a problem with 2 APIs, that cant run together. The 2 APIs are: ChatSetAttr from the API library, and an API called BigBrother. The problem is that BigBrother see all whisper messeges and sents a copy to the GM, and ChatSetAttr doesnt like that for some reason. So can anyone help me so I can use them both at the same time? The code for BigBrother API: /**
* Big Brother by Kyle G.
* Listens to any whispers sent to players/characters that are not gm and whispers the gm the contents
* of the message.
*
* API Commands:
* !bigBrother on/off - automatically whispers detected whispers to the gm
* (will also store the whisper in the chat archive).
* !bigBrother - displays the current status of the script (on/off).
*/
var BigBrother = BigBrother || (function(){
'use strict';
var version = '0.1.0',
scriptName = 'Big Brother',
validOnOptions = ['1', 'on'],
validOffOptions = ['0', 'off'],
handleInput = function(msg) {
if(msg.type === 'whisper' && msg.target_name !== 'GM' && msg.target !== 'gm' && state.BigBrother === 1) {
var output = "<div><p>(Message to TARGET from SENDER)</p><p><b>CONTENT</b></p>";
var sender = getObj('player', msg.playerid);
var speakingAs;
if(sender.get('speakingas') && sender.get('speakingas').indexOf('character|') !== -1) {
var character = getObj('character', sender.get('speakingas').split('|')[1]);
speakingAs = character.get('name');
} else {
speakingAs = sender.get('_displayname')
}
output = output.replace("TARGET", msg.target_name).replace("SENDER", speakingAs).replace("CONTENT", msg.content);
sendChat(scriptName, "/w gm " + output);
} else if (msg.type === 'api' && (msg.content.indexOf('!bigBrother') !== -1 || msg.content.indexOf('!bb') !== -1)) {
if(validOffOptions.indexOf(msg.content.split(' ')[1]) !== -1) {
state.BigBrother = 0;
} else if(validOnOptions.indexOf(msg.content.split(' ')[1]) !== -1) {
state.BigBrother = 1;
}
sendChat(scriptName, '/w gm ' + scriptName + ' - ' + (state.BigBrother? 'on' : 'off'));
}
},
checkInstall = function() {
log('->' + scriptName + ' v' + version + '<- Ready');
state.BigBrother = state.BigBrother || 1;
},
registerEventHandlers = function() {
on('chat:message', handleInput);
};
return {
CheckInstall: checkInstall,
RegisterEventHandlers: registerEventHandlers
};
}());
on('ready', function(){
'use strict';
BigBrother.CheckInstall();
BigBrother.RegisterEventHandlers();
});