Last active
August 29, 2015 14:00
-
-
Save itslenny/afc975e9ef5199610c95 to your computer and use it in GitHub Desktop.
Autoplay for Drowning in Problems by Notch (ludum)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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