Page 1 of 1
Add "silence" as an option in sound preferences
Posted: 16 June 2013, 18:09
by pejsek2
I would love to have the option to turn off the sound for chat, but leave all the other sounds. The constant plop-plopping is getting on my nerves sometimes, but I need to know when it's my turn.
Re: Add "silence" as an option in sound preferences
Posted: 16 June 2013, 18:33
by pikiou
So would I!
A while ago I created
this Greasmonkey script one of the features of which was to disable sounds unless it's your turn and you're not watching the game (so it beeps when it's your turn).
I recycled it into a smaller version dedicated to that feature only.
To install it, first get
TamperMonkey for Chrome, or
GreaseMonkey for Firefox.
Then create a new script with it and paste the following content:
Code: Select all
// ==UserScript==
// @name BGA sounds
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://*.boardgamearena.com/*
// @copyright 2012+, You
// ==/UserScript==
//No sound when window has focus
var dommy = new Object(); //Keeps track of modified functions, and some values
dommy.hasFocus = true;
window.addEventListener('focus', function () {
dommy.hasFocus = true;
}, false);
window.addEventListener('blur', function () {
dommy.hasFocus = false;
}, false);
window.setTimeout(function () {
redirect(unsafeWindow.soundManager, 'doPlay', redirectSound);
}, 2000);
function redirectSound() {
//Ignore all but running game pages
if (window.location.href.indexOf('table?table') == -1) {
//Don't make any sound if it's not your turn
if (arguments[0] && arguments[0].id != 'yourturn') {
return false;
}
//Don't make any sound if page has no focus
if (dommy.hasFocus) {
return false;
}
}
return arguments;
}
//General purpose functions
//Replace obj[func] function by repl
function redirect(obj, func, repl) {
if (!this.funcId) {
this.funcId = 0;
}
var id = ++this.funcId;
dommy[this.funcId] = obj[func];
dommy['repl' + this.funcId] = repl;
obj[func] = function () {
arguments = dommy['repl' + id].apply(this, arguments);
if (arguments === false) {
return;
}
return dommy[id].apply(this, arguments);
}
}
Do read the code if you think it could be malicious. I'm a BGA game dev, though, as can be verified on this game page:
http://en.boardgamearena.com/#!gamepane ... earnpiston
Edit: made it so sounds aren't modified when in the lobby.
Re: Add "silence" as an option in sound preferences
Posted: 16 June 2013, 21:48
by pejsek2
Thank you very much, Pikiou, this is really helpful and great! Just started using it and enjoying the silence
