I took down 541 zerglings with 778 APM

Posted by

Yep, that's right! I'm a Starcraft legend!

OK, not really... I'm actually a big fat cheater. I wrote a little Chrome extension that clicks on the zerglings. It only took about 10 minutes to write the first version, but it was actually a bit of tweaking to get it to work well. The first version just clicked on zerglings as fast as it could, but the problem with that was, the game never actually finished! I killed the zerglings before they could do any damage.

So I tweaked it so that it lets a couple of zerglings run around and do some damage. But the problem there was, the APM actually ends up being kind of low. Then I noticed if you click anywhere in the body it counts as an action, so the final script looks like this:

// kill the zerglings
setInterval(function() {
  var zergs = document.querySelectorAll(
                ".zr_zergling_container");
  if (zergs.length < 6) {
    // let a couple of them run around so that
    // the game will actually end (eventually...)
    return;
  }
  for (var i = 0; i < zergs.length; i++) {
    var evnt = document.createEvent("MouseEvents");
    evnt.initMouseEvent("mousedown", true, true, window,
        0, 0, 0, 0, 0, false, false, false, false, 0, null);
    zergs[i].dispatchEvent(evnt);
  }
}, 50);

// this'll keep our APM up, 100ms == 600APM
setInterval(function() {
  var evnt = document.createEvent("MouseEvents");
  evnt.initMouseEvent("mousedown", true, true, window,
        0, 0, 0, 0, 0, false, false, false, false, 0, null);
  document.body.dispatchEvent(evnt);
}, 100);

Take that, zerg rush!

blog comments powered by Disqus