Skip to content

Instantly share code, notes, and snippets.

@itslenny
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itslenny/afc975e9ef5199610c95 to your computer and use it in GitHub Desktop.
Save itslenny/afc975e9ef5199610c95 to your computer and use it in GitHub Desktop.
Autoplay for Drowning in Problems by Notch (ludum)
//Auto play for the game drowning located here: http://game.notch.net/drowning
// restuls in a stres free life full of riches and just a little more than enough "stuff"
function getStuffCount(){
var eq = document.getElementById("equipment");
if(!eq || !eq.innerHTML) return 0;
var eqHTML = eq.innerHTML;
var sPosEnd = eqHTML.indexOf(' Stuff');
if(sPosEnd < 0) return 0;
var sPosStart = eqHTML.lastIndexOf('>',sPosEnd);
return parseInt(eqHTML.substr(sPosStart+1,sPosEnd-sPosStart));
}
function getLinkName(link){
return link.parentNode.id
}
function clickLinks(){
var links = document.getElementsByTagName("a");
if(!links) return;
var stuffCount = getStuffCount();
for(var ii in links){
if(links && links[ii] && links[ii].click){
if(stuffCount > 9 && getLinkName(links[ii]) == 'morestuff') continue;
links[ii].click();
}
}
}
var autoDrown = setInterval(clickLinks,500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment