Skip to content

Instantly share code, notes, and snippets.

@dimdenGD
Last active November 29, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimdenGD/392c417ce46b272494bac73c3c982481 to your computer and use it in GitHub Desktop.
Save dimdenGD/392c417ce46b272494bac73c3c982481 to your computer and use it in GitHub Desktop.
Jitterclicker
/*
Jitterclicker
Thing I made for Minecraft PVP.
I have bad mouse and I can only do 6 CPS (Clicks Per Second) but with this thing I can do 12 CPS. It doubleclicks every time you left-click.
Hotkey for enabling/disabling: CTRL+X. Plays high note on enable and low note on disable.
Installing for noobs:
1. Install node.js.
2. Create folder, put this file in there.
3. Open CMD in that folder.
4. Run "npm install".
5. If you have errors, try using "npm init" and just pressing Enter on every question, and then try "npm install" again.
6. And if there's no errors run "node ." and wait like 3 seconds, and that's it.
To stop, close CMD or use CTRL+C (in CMD).
Questions? https://discord.gg/k4u7ddk OR https://dimden.dev/
*/
const ioHook = require('iohook');
const robot = require("robotjs");
const WebMidi = require("webmidi");
let enabled = false;
let clicked = false;
global.navigator = require('web-midi-api');
if (!global.performance) global.performance = { now: require('performance-now') };
WebMidi.enable(err => {
if (err) console.log("WebMidi could not be enabled.", err);
else console.log("WebMidi enabled!");
});
ioHook.on('mouseclick', event => {
if(clicked) return clicked = !clicked;
if(enabled && event.button === 1) {
robot.mouseClick();
clicked = true;
};
});
ioHook.on("keydown", key => {
if(key.ctrlKey && key.keycode === 45) enabled = !enabled;
else return;
if(enabled) WebMidi.outputs[0].playNote("B5", "all", {duration: 30});
else WebMidi.outputs[0].playNote("B2", "all", {duration: 30});
console.log(enabled);
});
ioHook.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment