Skip to content

Instantly share code, notes, and snippets.

@zchgdn
Created July 27, 2024 23:40
Show Gist options
  • Save zchgdn/dd1a2fb97003134779dce795bd42830e to your computer and use it in GitHub Desktop.
Save zchgdn/dd1a2fb97003134779dce795bd42830e to your computer and use it in GitHub Desktop.
/*
========== NEOPETS BATTLEDOME AUTO-FIGHT ==========
Step 1: Start a new battle in the Battledome and select your two weapons and skill
Step 2: Open your devtools (right click + inspect OR F12)
Step 3: Go to the Console tab
Step 4: Paste the code below and click 'enter' - now your Neopet will automatically fight the opponent. Great for Punchbag Bob!
There is an explanation to the code in the comments below for those weary about inputting random code into your developer console
*/
//This is the code that gets run
function checkAndClickButton() {
//This is a variable to reference the 'FIGHT!' button
const fightButton = document.getElementById('fight');
//This is a check to see if a) the 'FIGHT!' button exists and whether the button is inactive (greyed out)
if (fightButton && !fightButton.classList.contains('inactive')) {
//If the button exists and isn't inactive, the browser will trigger a click of the 'FIGHT!' button
fightButton.click();
}
}
//This runs the function (that checks and clicks the button) every 500ms
setInterval(checkAndClickButton, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment