Skip to content

Instantly share code, notes, and snippets.

@error454
Created February 26, 2013 21:31
Show Gist options
  • Save error454/5042407 to your computer and use it in GitHub Desktop.
Save error454/5042407 to your computer and use it in GitHub Desktop.
Scans for and destroys all zerglings in half second intervals. Meant to be used as a greasemonkey script in chrome but you could just paste the code into a console while playing the game.
// ==UserScript==
// @name Zerg Defense
// @namespace http://mobilecoder.wordpress.com
// @version 1.0
// @description The Zerg Rush is coming, prepare yourself!
// @match https://www.google.com/search?q=zerg+rush*
// ==/UserScript==
var doMouseEvent = function(element, args) {
var event = document.createEvent("MouseEvents");
event.initEvent.apply(event, Array.prototype.slice.call(arguments, 1));
element.dispatchEvent(event);
};
setInterval(seekAndDestroy, 500);
function seekAndDestroy(){
var zergs = document.getElementsByClassName("zr_zergling_container")
for(var zergI = 0; zergI < zergs.length; zergI++){
for(clickI = 0; clickI < 3; clickI++){
doMouseEvent(zergs[zergI], 'mousedown');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment