Skip to content

Instantly share code, notes, and snippets.

@cr4m3r
Last active August 8, 2016 02:17
Show Gist options
  • Save cr4m3r/e18d16070ec72932623d to your computer and use it in GitHub Desktop.
Save cr4m3r/e18d16070ec72932623d to your computer and use it in GitHub Desktop.
adds +1% to my Tagpro username at the end of every game
// ==UserScript==
// @name Get Fatter
// @namespace http://www.reddit.com/u/slothbear
// @description Adds 1% to bodyfat after every game.
// @include http://tagpro-*.koalabeast.com:*
// @include http://tangent.jukejuice.com:*
// @include http://*.newcompte.fr:*
// @author slothbear / %bodyfat
// @version 1.4
// @downloadURL https://gist.github.com/cr4m3r/e18d16070ec72932623d/raw/tagpro_getFatter.user.js
// ==/UserScript==
// Script adds 1% to my bodyfat at the end of the game.
tagpro.ready(function () {
console.log("GET FATTER BEGIN!");
// Call getFatter() at end of game.
tagpro.socket.on("end", function (e) {
console.log("GET FATTER SENSES THE END IS NEAR!");
getFatter();
});
// Makes script PUB only.
if (tagpro.group.socket)
return;
});
// Collect current name, make a new one with +1% bodyfat, and
// and send it to tagpro.
function getFatter() {
var currentName = tagpro.players[tagpro.playerId]["name"];
var newName = currentName.replace(/(\d+)\%/, function (j, a) {
return a - -1 + "%";
});
console.log("TIME TO GAIN SOME WEIGHT!");
tagpro.socket.emit('name', newName || 'error');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment