Skip to content

Instantly share code, notes, and snippets.

@brianarn
Last active January 10, 2025 20:31
Show Gist options
  • Save brianarn/6d8d799b129a63f965d92e8c6e33ea97 to your computer and use it in GitHub Desktop.
Save brianarn/6d8d799b129a63f965d92e8c6e33ea97 to your computer and use it in GitHub Desktop.

Revisions

  1. brianarn revised this gist Jan 10, 2025. 1 changed file with 10 additions and 4 deletions.
    14 changes: 10 additions & 4 deletions stim-auto.js
    Original file line number Diff line number Diff line change
    @@ -25,18 +25,21 @@ window._stimAuto = (function () {
    // Also, we don't want to select the ocean button, as we never want to click that automatically
    const upgradeButtonSelector = `.upgrade:not(.upgrade-disabled) .upgrade-icon:not(${oceanAttr})`;

    // There are also powerups that we want to click on
    const powerupSelector = "img.powerup";

    // Given our selectors, make our main query
    const buttonsQuery = `${buttonSelectors
    .map((item) => `${item}:not(${item}-hide)`)
    .join(", ")}, ${upgradeButtonSelector}`;
    .join(", ")}, ${upgradeButtonSelector}, ${powerupSelector}`;

    function clickEverything() {
    document.querySelectorAll(buttonsQuery).forEach((button) => {
    button.click();
    });
    }

    function startAutomation() {
    function startAutomation(stopAtOcean = true) {
    if (intervalID) {
    console.log("Trying to start automation but it's already running");
    return;
    @@ -50,8 +53,9 @@ window._stimAuto = (function () {
    return;
    }

    if (document.querySelector(oceanEnabled)) {
    console.log("The ocean button is enabled, stopping");
    if (stopAtOcean && document.querySelector(oceanEnabled)) {
    console.log("The ocean button is enabled, stopping.");
    console.log("If you wish to restart while still skipping the ocean, run _stimAuto.start(false)");
    clearAutomationInterval();
    return;
    }
    @@ -65,6 +69,8 @@ window._stimAuto = (function () {
    clearInterval(intervalID);
    intervalID = null;
    }

    // The object that exposes our public methods
    const stimAuto = {
    start: startAutomation,
    stop: clearAutomationInterval,
  2. brianarn revised this gist Jan 10, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stim-auto.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ window._stimAuto = (function () {
    let intervalID = null;

    const titleSelector = ".title-screen";
    const oceanAttr = `[src$="ocean.webp"]`;
    const oceanAttr = '[src$="ocean.webp"]';
    const oceanEnabled = `.upgrade:not(.upgrade-disabled) > .upgrade-icon${oceanAttr}`;
    const buttonSelectors = [
    ".main-btn", // The main button
  3. brianarn revised this gist Jan 10, 2025. 1 changed file with 13 additions and 9 deletions.
    22 changes: 13 additions & 9 deletions stim-auto.js
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,9 @@ window._stimAuto = (function () {
    const intervalMS = 10;
    let intervalID = null;

    const titleSelector = ".title-screen";
    const oceanAttr = `[src$="ocean.webp"]`;
    const oceanEnabled = `.upgrade:not(.upgrade-disabled) > .upgrade-icon${oceanAttr}`;
    const buttonSelectors = [
    ".main-btn", // The main button
    ".collect", // Collecting the leveling reward
    @@ -17,19 +20,20 @@ window._stimAuto = (function () {
    ".action-btn", // Feed the chicken
    ".egg", // Collect the kinder eggs
    ];
    const titleSelector = ".title-screen";
    const oceanAttr = `[src$="ocean.webp"]`;
    const oceanEnabled = `.upgrade:not(.upgrade-disabled) > .upgrade-icon${oceanAttr}`

    let buttonsQuery = buttonSelectors
    .map((item) => `${item}:not(${item}-hide)`)
    .join(",");
    // Upgrade buttons are special, since they don't use -hide but have a -disabled parent
    // Also, we don't want to select the ocean button, as we never want to click that automatically
    const upgradeButtonSelector = `.upgrade:not(.upgrade-disabled) .upgrade-icon:not(${oceanAttr})`;

    // Upgrade icons are handled more uniquely, as we don't want to click the ocean endgame icon
    buttonsQuery = `${buttonsQuery},.upgrade-icon:not(.upgrade-icon-hide,${oceanAttr})`;
    // Given our selectors, make our main query
    const buttonsQuery = `${buttonSelectors
    .map((item) => `${item}:not(${item}-hide)`)
    .join(", ")}, ${upgradeButtonSelector}`;

    function clickEverything() {
    document.querySelectorAll(buttonsQuery).forEach((button) => { button.click() });
    document.querySelectorAll(buttonsQuery).forEach((button) => {
    button.click();
    });
    }

    function startAutomation() {
  4. brianarn revised this gist Jan 10, 2025. 2 changed files with 16 additions and 4 deletions.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,6 @@

    This is a script that attempts to click all the things in stimulation clicker for you, turning it into more of an idle game.

    Be warned, it makes a HORRIBLE noise since it's clicking so rapidly.
    Be warned, it makes a HORRIBLE noise since it's clicking so rapidly.

    It's set to _not_ click the ocean button for you, but will stop automation when the ocean button is detected and not disabled.
    16 changes: 13 additions & 3 deletions stim-auto.js
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,6 @@ window._stimAuto = (function () {

    const buttonSelectors = [
    ".main-btn", // The main button
    ".upgrade-icon", // The various upgrades
    ".collect", // Collecting the leveling reward
    ".press-collect", // Collecting the hydraulic press
    ".press-btn", // Start the hydraulic press
    @@ -19,13 +18,18 @@ window._stimAuto = (function () {
    ".egg", // Collect the kinder eggs
    ];
    const titleSelector = ".title-screen";
    const oceanAttr = `[src$="ocean.webp"]`;
    const oceanEnabled = `.upgrade:not(.upgrade-disabled) > .upgrade-icon${oceanAttr}`

    const buttonsQuery = buttonSelectors
    let buttonsQuery = buttonSelectors
    .map((item) => `${item}:not(${item}-hide)`)
    .join(",");

    // Upgrade icons are handled more uniquely, as we don't want to click the ocean endgame icon
    buttonsQuery = `${buttonsQuery},.upgrade-icon:not(.upgrade-icon-hide,${oceanAttr})`;

    function clickEverything() {
    document.querySelectorAll(buttonsQuery).forEach((button) => button.click());
    document.querySelectorAll(buttonsQuery).forEach((button) => { button.click() });
    }

    function startAutomation() {
    @@ -42,6 +46,12 @@ window._stimAuto = (function () {
    return;
    }

    if (document.querySelector(oceanEnabled)) {
    console.log("The ocean button is enabled, stopping");
    clearAutomationInterval();
    return;
    }

    clickEverything();
    }, intervalMS);
    }
  5. brianarn created this gist Jan 10, 2025.
    5 changes: 5 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # Stimulation Clicker Automated

    This is a script that attempts to click all the things in stimulation clicker for you, turning it into more of an idle game.

    Be warned, it makes a HORRIBLE noise since it's clicking so rapidly.
    62 changes: 62 additions & 0 deletions stim-auto.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    /*
    * Stimulation Clicker Automator
    * by Brian Sinclair (@brianarn)
    * MIT License, do whatever
    */
    window._stimAuto = (function () {
    const intervalMS = 10;
    let intervalID = null;

    const buttonSelectors = [
    ".main-btn", // The main button
    ".upgrade-icon", // The various upgrades
    ".collect", // Collecting the leveling reward
    ".press-collect", // Collecting the hydraulic press
    ".press-btn", // Start the hydraulic press
    ".loot-box-target", // Loot boxes
    ".question-choice", // Duolingo options
    ".action-btn", // Feed the chicken
    ".egg", // Collect the kinder eggs
    ];
    const titleSelector = ".title-screen";

    const buttonsQuery = buttonSelectors
    .map((item) => `${item}:not(${item}-hide)`)
    .join(",");

    function clickEverything() {
    document.querySelectorAll(buttonsQuery).forEach((button) => button.click());
    }

    function startAutomation() {
    if (intervalID) {
    console.log("Trying to start automation but it's already running");
    return;
    }

    console.log("Starting automation...");
    intervalID = setInterval(() => {
    if (document.querySelector(titleSelector)) {
    console.log("Title screen detected, stopping");
    clearAutomationInterval();
    return;
    }

    clickEverything();
    }, intervalMS);
    }

    function clearAutomationInterval() {
    console.log("Clearing automation interval");
    clearInterval(intervalID);
    intervalID = null;
    }
    const stimAuto = {
    start: startAutomation,
    stop: clearAutomationInterval,
    };

    stimAuto.start();

    return stimAuto;
    })();