Skip to content

Instantly share code, notes, and snippets.

@CodySelman
Last active August 25, 2025 07:16
Show Gist options
  • Select an option

  • Save CodySelman/9a6315726d4230c0a8168d09e9f34146 to your computer and use it in GitHub Desktop.

Select an option

Save CodySelman/9a6315726d4230c0a8168d09e9f34146 to your computer and use it in GitHub Desktop.
Script for Clickpocalypse 2 (https://www.minmaxia.com/c2/). Automatically purchases upgrades, uses scrolls, uses potions, and gets loot.
(function clickPocalypseBot() {
const mouseupEvent = new MouseEvent('mouseup', {
bubbles: true, // Allows the event to bubble up the DOM tree
cancelable: true, // Allows the event to be canceled
view: window, // The window in which the event occurred
clientX: 100, // X-coordinate of the mouse pointer
clientY: 150, // Y-coordinate of the mouse pointer
button: 0, // 0 for left button, 1 for middle, 2 for right
buttons: 0 // Indicates no buttons are currently pressed
});
function upgrade() {
const upgradeElement = document.getElementById("upgradeButtonContainer_0");
upgradeElement.dispatchEvent(mouseupEvent);
}
function usePotions() {
const potions = document.getElementsByClassName('potionButton');
for (var i = 0; i < potions.length; i++) {
potions[i].dispatchEvent(mouseupEvent);
}
}
function useScrolls() {
const scrolls = document.getElementsByClassName('scrollButton')
for (var i = 0; i < scrolls.length; i++) {
scrolls[i].dispatchEvent(mouseupEvent);
}
}
function getLoot() {
const lootButton = document.getElementsByClassName('lootButton');
for (var i = 0; i < lootButton.length; i++) {
lootButton[i].dispatchEvent(mouseupEvent);
}
}
// check for upgrades every second
upgrade();
setInterval(upgrade, 1000);
// check for potions every minute
usePotions();
setInterval(usePotions, 1000 * 60);
// check for scrolls every 0.5 second
useScrolls();
setInterval(useScrolls, 500);
// check for loot every second
getLoot();
setInterval(getLoot, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment