added iterationsper photo option
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"iterationsPerPhoto": 3,
|
||||||
"photoInterval": 2,
|
"photoInterval": 2,
|
||||||
"targetColor": {
|
"targetColor": {
|
||||||
"r": 85,
|
"r": 85,
|
||||||
@@ -6,5 +7,5 @@
|
|||||||
"b": 49,
|
"b": 49,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"tolerance": 2
|
"tolerance": 20
|
||||||
}
|
}
|
4
main.js
4
main.js
@@ -11,6 +11,7 @@ const targetColor = config.targetColor;
|
|||||||
|
|
||||||
const tolerance = config.tolerance;
|
const tolerance = config.tolerance;
|
||||||
|
|
||||||
|
const iterationsPerPhoto = config.iterationsPerPhoto;
|
||||||
|
|
||||||
setInterval(eatDrywall, photoInterval * 1000);
|
setInterval(eatDrywall, photoInterval * 1000);
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ function clickRandomPixelOfColor(width, height, image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(hits.length);
|
console.log(hits.length);
|
||||||
clickRandomDrywalls(hits,width,1);
|
clickRandomDrywalls(hits, width, iterationsPerPhoto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -84,6 +85,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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user