Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (() => {
- if (window.stopStarflingBot) window.stopStarflingBot();
- const TARGET_SCORE = 9999; // change to the score/flag threshold you need
- const FINISH_WITH_GAME_OVER = true; // log/show final score once target is reached
- let running = true;
- let raf = 0;
- window.stopStarflingBot = () => {
- running = false;
- cancelAnimationFrame(raf);
- console.log("[starfling] stopped at score:", typeof sc === "number" ? sc : "?");
- };
- snd = false; // mute
- const tick = () => {
- if (!running) return;
- if (typeof st === "undefined" || typeof S === "undefined") {
- console.log("[starfling] globals not found");
- return window.stopStarflingBot();
- }
- if (st === S.MENU) {
- handleTap();
- } else if (st === S.PAUSE) {
- document.getElementById("resume-btn")?.click();
- } else if (st === S.DEAD) {
- document.getElementById("retry-btn")?.click();
- } else if (st === S.PLAY && bl && bl.alive && bl.orb) {
- if (sc >= TARGET_SCORE) {
- console.log("[starfling] target reached:", sc);
- if (FINISH_WITH_GAME_OVER && typeof die === "function") die();
- return window.stopStarflingBot();
- }
- const targetIndex = wl[cWI + 2] ? cWI + 2 : cWI + 1;
- if (targetIndex > cWI) {
- bl.firstPass = true; // force combo growth
- catchW(targetIndex, targetIndex - (cWI + 1)); // usually skip one star for extra points
- }
- }
- raf = requestAnimationFrame(tick);
- };
- tick();
- })();
Advertisement