Compare commits

...

9 Commits

Author SHA1 Message Date
9187d5cc90 arr 2025-06-15 23:37:34 +00:00
APEX FIGHT
660f668d22 made faster and formatted 2025-04-08 22:00:07 -04:00
APEX FIGHT
eabf897be6 readmemoree 2025-04-08 21:52:40 -04:00
APEX FIGHT
4c9a1a8102 readmeeee 2025-04-08 21:52:26 -04:00
APEX FIGHT
9a144f938e update readme 2025-04-08 21:52:08 -04:00
APEX FIGHT
57f3767d57 made better fuck you kys 2025-04-08 21:50:59 -04:00
APEX FIGHT
a2c522fea2 added iterationsper photo option 2025-04-08 21:30:21 -04:00
APEX FIGHT
8798d7b2a7 added setupfiles and used pydirectinput for compatibility 2025-04-08 21:24:45 -04:00
APEX FIGHT
ba4d78c3d2 improved behavior and fixed bugs 2025-04-08 21:03:52 -04:00
6 changed files with 68 additions and 17 deletions

View File

@@ -1,9 +1,14 @@
# 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.

View File

@@ -1,8 +1,11 @@
import sys
import pydirectinput
import pyautogui
x = int(sys.argv[1])
y = int(sys.argv[2])
x = sys.argv[1]
y = sys.argv[2]
pyautogui.click(x,y)
print("\n" + str(x) + str(y) + "\n")
pyautogui.moveTo(x,y, .1)
pydirectinput.moveTo(x,y)
pyautogui.click(clicks=4, interval=.1)

View File

@@ -1,10 +1,11 @@
{
"photoInterval": 5, //interval in seconds to snap a photo and eat drywall
"targetColor": { //target color to click on
"r": 0,
"g": 0,
"b": 0,
"iterationsPerPhoto": 6,
"photoInterval": 1,
"targetColor": {
"r": 85,
"g": 73,
"b": 49,
"a": 255
},
"tolerance": 20 //color tolerance (basic taxicab direction currently)
"tolerance": 20
}

26
main.js
View File

@@ -3,6 +3,7 @@ const ss = require("node-screenshots");
const proc = require("child_process");
const fs = require("fs");
let config = JSON.parse(fs.readFileSync("./config.jsonc"));
const photoInterval = config.photoInterval;
@@ -11,9 +12,15 @@ const targetColor = config.targetColor;
const tolerance = config.tolerance;
const iterationsPerPhoto = config.iterationsPerPhoto;
setInterval(eatDrywall, photoInterval * 1000);
async function eatDrywall() {
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("Clicking: " + target);
proc.execSync("python click.py " + target.x + " " + target.y);
console.log(hits.length);
clickRandomDrywalls(hits, width, iterationsPerPhoto);
}
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
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;
if (Math.abs(sum1 - sum2) < (tolerance * 4)) {
//console.log(Math.abs(sum1 - sum2));
return true;
} else return false;
}

5
setup.bat Normal file
View File

@@ -0,0 +1,5 @@
python -m ensurepip
pip install pyautogui
pip install PyDirectInput
pip install keyboard
npm i

19
start.py Normal file
View File

@@ -0,0 +1,19 @@
import subprocess
import keyboard
#async def subp():
proc = subprocess.Popen("node main")
#asyncio.run(subp())
while True:
try:
if keyboard.is_pressed('q'):
proc.kill()
exit()
except:
print("q")
proc.kill()
exit()