Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Conflicting APIs

1647886427
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(); });
1647956665
timmaugh
Pro
API Scripter
That's a pretty short and to-the-point script. Are you sure it is BigBrother that is causing the problem? Do you have any other scripts installed? And can you describe the issue you are having when this goes sideways? What do you do, what would you expect to happen, and what actually happens?
1647964136
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Are you using the inline chatsetAttr capability, where chatsetattr can react to rolls in a roll template?