CookieMonsterTeam / CookieMonster

Addon for Cookie Clicker that offers a wide range of tools and statistics to enhance the game
MIT License
499 stars 207 forks source link

Add autoclicker functionality #90

Closed brian473 closed 8 years ago

brian473 commented 8 years ago

You can easily start and stop autoclicking functionality using setInterval and Game.clickCookie(). If you could put this on a button in the UI it would be very helpful, especially since the current meta requires autoclicking. I don't consider this to be cheating since you could download a program to simulate fast mouse clicks anyways.

I've written some code to encapsulate the autoclicking functionality:

function Autoclicker () {

    var clicking = false;
    var autoClicker = null;

    // shouldClick (optional) - boolean value representing whether to click or not.
    // if not included will toggle current status.
    this.toggleClicking = function(shouldClick) {
        clicking = shouldClick != null ? shouldClick : !clicking;

        if (clicking) {
            // the previous interval may still be going, so clear it just in case
            if (autoClicker) {
                clearInterval(autoClicker);
            }
            autoClicker = setInterval(Game.ClickCookie, 0);
        }
        else {
            clearInterval(autoClicker);
        }
    };
};

Usage example:

var clicker = new Autoclicker();
clicker.toggleClicking();
Aktanusa commented 8 years ago

Hmm, this is a hard one. I myself find it cheating and have been playing without any auto-clickers. Right now my stance is to not add this but if enough people really want it, I may change my mind.

svschouw commented 8 years ago

So far CookieMonster is mostly informational. I think the only real game interaction it has is popping wrinklers and even that requires a direct user action and can hardly be used to cheat. Allowing the game to do actions on its own is not really what CookieMonster is about in my opinion. So I vote against this.

Bisa commented 8 years ago

I agree with @svschouw, please keep this an informative add-on, if people want to auto click and essentially ruin the feeling of achievement they can get the clicking feature elsewhere imho.

philer commented 8 years ago

I have written a very simple bookmark to autoclick during lucky + click frenzy golden cookie combos. The reason is that frantically clicking my mouse is quite annoying to the people around me (plus I'm a bit worried about my mouse). I don't want that but I also don't want to lose the massive bonus that can be acquired in this short period of time. So this tiny script simulates realistic clicking for an appropriate period. You can use it in a bookmark similar to the plugin loader for cookie monster.

To start the autoclicking just click on the bookmark, then hover your cursor over the big cookie (careful, you can pop wrinklers if you hover over them!)

Configuration is on the first line, where s is the number of seconds the auto clicking should run for (slightly less than the full duration of a clicking frenzy) and p corresponds to the number of clicks per second (10 clicks per second is fast but realistic).

javascript:(function() {
  var s = 24, ps = 8;
  var c = document.getElementById("bigCookie");
  var d = 1000/ps, m = s * ps, k = 0;
  var i = setInterval(function() {
        c.click();
        if (++k > m) clearInterval(i);
      }, d);
})()

I hope that helps someone. Personally I also don't think autoclick should be part of cookie monster, which is otherwise purely information based.

Aktanusa commented 8 years ago

Thanks a lot @philer! I'll give it a few more days, but so far leaning towards won't fix

Aktanusa commented 8 years ago

Sorry, I've decided to not add this functionality to Cookie Monster.