Last active
August 26, 2024 23:51
-
-
Save MarvNC/1631bf5093aadca449d1a0bad940383f to your computer and use it in GitHub Desktop.
Mythfall Auto Ability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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