Detect colors similar to another color?
Posted: 17 Jun 2019, 12:14
Hello,
I am a lazy person. so I am currently playing some idle clicker kind of game and dont feel like excessively clicking.
the repeated clicking part is solved, also made it so that pressing z will toggle the auto click on and off.
but I still have to move the mouse.
i want to automate that part as well.
so as it is each enemy has a red health bar above it's head.
the sprites are pretty big.
so I wanna go the easy way, search for a red rectangle (they all look the same, for the most part)
and click a fixed distance below it.
if the enemy dies, the rectangle disappears too.
so it shoudl autoskip to the next enemy.
now just finding the rectangle is the thing.
just used made a screenshot of the game and used the script:
"
z:: ; Z hotkey.
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%, Alt
MsgBox The color at the current cursor position is %color%.
return"
to look at the red rectangle.
however depending on where I click in that rectangle (on the screenshot) the color is different.
so something like "if color=0x1d5f8S"
wont do it since the rectangle consists of different shades of that light red.
so do you have any idea what I could do with pixelgetcolor to get that certain range of red pixels?
or any other good idea how to pinpoin that red rectangle?
givent that i am doing the clicking every 70 milisecond, it would be good if it was some fast algorithm or something.
Thank you in advance
I am a lazy person. so I am currently playing some idle clicker kind of game and dont feel like excessively clicking.
the repeated clicking part is solved, also made it so that pressing z will toggle the auto click on and off.
but I still have to move the mouse.
i want to automate that part as well.
so as it is each enemy has a red health bar above it's head.
the sprites are pretty big.
so I wanna go the easy way, search for a red rectangle (they all look the same, for the most part)
and click a fixed distance below it.
if the enemy dies, the rectangle disappears too.
so it shoudl autoskip to the next enemy.
now just finding the rectangle is the thing.
just used made a screenshot of the game and used the script:
"
z:: ; Z hotkey.
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%, Alt
MsgBox The color at the current cursor position is %color%.
return"
to look at the red rectangle.
however depending on where I click in that rectangle (on the screenshot) the color is different.
so something like "if color=0x1d5f8S"
wont do it since the rectangle consists of different shades of that light red.
so do you have any idea what I could do with pixelgetcolor to get that certain range of red pixels?
or any other good idea how to pinpoin that red rectangle?
givent that i am doing the clicking every 70 milisecond, it would be good if it was some fast algorithm or something.
Thank you in advance