Skip to content

Instantly share code, notes, and snippets.

@MarvNC
Last active August 26, 2024 23:51
Show Gist options
  • Save MarvNC/1631bf5093aadca449d1a0bad940383f to your computer and use it in GitHub Desktop.
Save MarvNC/1631bf5093aadca449d1a0bad940383f to your computer and use it in GitHub Desktop.
Mythfall Auto Ability
// ==UserScript==
// @name Auto Ability
// @namespace https://github.com/MarvNC
// @match https://mythfall.dev/*
// @grant GM.registerMenuCommand
// @grant GM.unregisterMenuCommand
// @version 1.3
// @author MarvNC
// @description Spams ability
// ==/UserScript==
(function () {
'use strict';
let isActive = false;
let intervalId = null;
let menuCommandId = null;
function toggleAbilityUse() {
isActive = !isActive;
updateMenu();
if (isActive) {
intervalId = setInterval(sendMiddleClick, 1050);
} else {
clearInterval(intervalId);
}
}
function updateMenu() {
if (menuCommandId !== null) {
GM.unregisterMenuCommand(menuCommandId);
}
menuCommandId = GM.registerMenuCommand(
`Auto Ability: ${isActive ? 'Active' : 'Disabled'}`,
toggleAbilityUse
);
}
function sendMiddleClick() {
const canvas = document.getElementById('glfw');
canvas.dispatchEvent(
new MouseEvent('mousedown', {
bubbles: true,
clientX: 100,
clientY: 100,
button: 1,
})
);
}
// Initial menu registration
updateMenu();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment