Created
July 24, 2019 13:00
-
-
Save cagataycali/6c1b2ab582752587842aa1696bd2b1ae to your computer and use it in GitHub Desktop.
Minecraft skyblock cobblestone generator's robot.
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
// npm i robotjs | |
const robot = require('robotjs') | |
const {width, height} = robot.getScreenSize() | |
const sleep = s => new Promise(resolve => setTimeout(_ => resolve(s), 1000 * s)) | |
let counter = 1 | |
let runned = 0 | |
const run = async () => { | |
// Drag mouse to center of screen. | |
robot.moveMouse(width / 2, height / 2) | |
// Mouse click and hold. | |
robot.mouseToggle('down') | |
await sleep(0.9) | |
// Mouse release | |
robot.mouseToggle('up') | |
// Wait for new block (May check pixel color) | |
await sleep(1.8) | |
counter++ | |
counter = counter % 6 == 0 ? 1 : counter | |
// Change pix | |
robot.keyTap(`${counter}`); | |
runned++ | |
console.log(`breaked ${runned} times block`) | |
run() | |
} | |
// Go back to game. | |
sleep(5).then(_ => run()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment