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.
Stimulation Clicker Automation

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.

It's set to not click the ocean button for you, but will stop automation when the ocean button is detected and not disabled.

/*
* Stimulation Clicker Automator
* by Brian Sinclair (@brianarn)
* MIT License, do whatever
*/
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
".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
];
// 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})`;
// 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}, ${powerupSelector}`;
function clickEverything() {
document.querySelectorAll(buttonsQuery).forEach((button) => {
button.click();
});
}
function startAutomation(stopAtOcean = true) {
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;
}
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;
}
clickEverything();
}, intervalMS);
}
function clearAutomationInterval() {
console.log("Clearing automation interval");
clearInterval(intervalID);
intervalID = null;
}
// The object that exposes our public methods
const stimAuto = {
start: startAutomation,
stop: clearAutomationInterval,
};
stimAuto.start();
return stimAuto;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment