Compare commits
9 Commits
18052d3d89
...
main
Author | SHA1 | Date | |
---|---|---|---|
9187d5cc90 | |||
![]() |
660f668d22 | ||
![]() |
eabf897be6 | ||
![]() |
4c9a1a8102 | ||
![]() |
9a144f938e | ||
![]() |
57f3767d57 | ||
![]() |
a2c522fea2 | ||
![]() |
8798d7b2a7 | ||
![]() |
ba4d78c3d2 |
11
README.md
11
README.md
@@ -1,9 +1,14 @@
|
|||||||
# eatdrywallbot
|
# eatdrywallbot
|
||||||
|
|
||||||
A bot for eat drywall probably idk.
|
A bot for eat drywall probably idk
|
||||||
|
|
||||||
|
|
||||||
|
Setup with ```start setup.bat```
|
||||||
|
|
||||||
Run with `node main`.
|
Run with ```python start.py```
|
||||||
|
|
||||||
Configure in "config.jsonc".
|
Press "q" anywhere to quit
|
||||||
|
|
||||||
|
Configure in "config.jsonc"
|
||||||
|
|
||||||
|
© 2025 Valerie Hamilton - All Rights Reserved.
|
||||||
|
11
click.py
11
click.py
@@ -1,8 +1,11 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import pydirectinput
|
||||||
import pyautogui
|
import pyautogui
|
||||||
|
|
||||||
|
x = int(sys.argv[1])
|
||||||
|
y = int(sys.argv[2])
|
||||||
|
|
||||||
x = sys.argv[1]
|
print("\n" + str(x) + str(y) + "\n")
|
||||||
y = sys.argv[2]
|
pyautogui.moveTo(x,y, .1)
|
||||||
|
pydirectinput.moveTo(x,y)
|
||||||
pyautogui.click(x,y)
|
pyautogui.click(clicks=4, interval=.1)
|
13
config.jsonc
13
config.jsonc
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"photoInterval": 5, //interval in seconds to snap a photo and eat drywall
|
"iterationsPerPhoto": 6,
|
||||||
"targetColor": { //target color to click on
|
"photoInterval": 1,
|
||||||
"r": 0,
|
"targetColor": {
|
||||||
"g": 0,
|
"r": 85,
|
||||||
"b": 0,
|
"g": 73,
|
||||||
|
"b": 49,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"tolerance": 20 //color tolerance (basic taxicab direction currently)
|
"tolerance": 20
|
||||||
}
|
}
|
26
main.js
26
main.js
@@ -3,6 +3,7 @@ const ss = require("node-screenshots");
|
|||||||
const proc = require("child_process");
|
const proc = require("child_process");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
|
|
||||||
let config = JSON.parse(fs.readFileSync("./config.jsonc"));
|
let config = JSON.parse(fs.readFileSync("./config.jsonc"));
|
||||||
|
|
||||||
const photoInterval = config.photoInterval;
|
const photoInterval = config.photoInterval;
|
||||||
@@ -11,9 +12,15 @@ const targetColor = config.targetColor;
|
|||||||
|
|
||||||
const tolerance = config.tolerance;
|
const tolerance = config.tolerance;
|
||||||
|
|
||||||
|
const iterationsPerPhoto = config.iterationsPerPhoto;
|
||||||
|
|
||||||
setInterval(eatDrywall, photoInterval * 1000);
|
setInterval(eatDrywall, photoInterval * 1000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function eatDrywall() {
|
async function eatDrywall() {
|
||||||
let monitors = ss.Monitor.all();
|
let monitors = ss.Monitor.all();
|
||||||
|
|
||||||
@@ -36,13 +43,23 @@ function clickRandomPixelOfColor(width, height, image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
let click = Math.floor(Math.random() * hits.length); //get index of random viable pixel
|
|
||||||
|
|
||||||
let target = deRasterize(hits[click], width);//get coordinates of random pixel
|
console.log(hits.length);
|
||||||
console.log("Clicking: " + target);
|
clickRandomDrywalls(hits, width, iterationsPerPhoto);
|
||||||
proc.execSync("python click.py " + target.x + " " + target.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function clickRandomDrywalls(hits, width, repetitions) {
|
||||||
|
for (let i = 0; i < repetitions; i++) {
|
||||||
|
|
||||||
|
let click = Math.floor(Math.random() * hits.length); //get index of random viable pixel
|
||||||
|
let target = deRasterize(hits[click], width);//get coordinates of random pixel
|
||||||
|
console.log("Clicking: " + JSON.stringify(target));
|
||||||
|
console.log(proc.exec("python click.py " + target.x + " " + target.y).toString());
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 200));
|
||||||
|
}
|
||||||
|
}
|
||||||
function rasterize(x, y, width) { //scale to image
|
function rasterize(x, y, width) { //scale to image
|
||||||
return (x + y * width);
|
return (x + y * width);
|
||||||
}
|
}
|
||||||
@@ -59,6 +76,7 @@ function compareColors(c1, c2) { //compare two rgba color structs
|
|||||||
let sum2 = c2.r + c2.g + c2.b + c2.a;
|
let sum2 = c2.r + c2.g + c2.b + c2.a;
|
||||||
|
|
||||||
if (Math.abs(sum1 - sum2) < (tolerance * 4)) {
|
if (Math.abs(sum1 - sum2) < (tolerance * 4)) {
|
||||||
|
//console.log(Math.abs(sum1 - sum2));
|
||||||
return true;
|
return true;
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
5
setup.bat
Normal file
5
setup.bat
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
python -m ensurepip
|
||||||
|
pip install pyautogui
|
||||||
|
pip install PyDirectInput
|
||||||
|
pip install keyboard
|
||||||
|
npm i
|
Reference in New Issue
Block a user