Skip to content

Instantly share code, notes, and snippets.

@EdGruberman
Last active August 29, 2015 14:23
Show Gist options
  • Save EdGruberman/d8ce793a56b33feca1ee to your computer and use it in GitHub Desktop.
Save EdGruberman/d8ce793a56b33feca1ee to your computer and use it in GitHub Desktop.
MSG15 game changer
var target = 58008;
function change(leave, join) {
if (leave != 0) {
console.log('-- leaving game ' + leave);
$J.post(
'http://steamcommunity.com/minigame/ajaxleavegame/'
, { 'gameid' : leave, 'sessionid' : g_sessionID }
).done(
function() { change(0, join); }
);
}
console.log('joining game ' + join);
$J.post(
'http://steamcommunity.com/minigame/ajaxjoingame/'
, { 'gameid' : join }
).done( function(json) {
if (json.success != '1') {
console.log('-- failed to join room ' + join);
return;
}
top.location.href = 'http://steamcommunity.com/minigame/towerattack/';
}
).fail( function(xhr) {
var response = xhr.responseText.evalJSON();
if (response.success == '24' && response.errorMsg)
console.log('-- failed to join room ' + join + '; ' + response.errorMsg );
else if (response.success == '25')
console.log('-- failed to join room ' + join + '; full');
else
console.log('-- failed to join room ' + join + '; ' + response.success);
}
);
}
var current = ShowFriendsGames.toString().match(/'current_gameid' : '([0-9]*)'/)[1];
console.log('current game: ' + current);
setInterval(change(current, target), 1000);
change(current, target);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment