PixelSearch search area help
PixelSearch search area help
Hello, I started using AHK a few months ago to automate some tasks and I'm still learning. I wanted to make a script for a single player game that alerts me of low health, but the health bar is always moving around the screen. I can't search the entire screen because it constantly causes false positives and I can't use image search because it's too inconsistent. I created a quick art demonstration so I can explain what I need help with. I want to be able to create a search area that follows the blue health bar and only searches in this box. And then I'll use the coordinates of the box to do a pixelsearch to test for a positive and alert me.
can anyone help me with understanding how I make this search area and also make it follow the blue healthbar?
Any help is very appreciated.
can anyone help me with understanding how I make this search area and also make it follow the blue healthbar?
Any help is very appreciated.
- Attachments
-
- image.png (81.58 KiB) Viewed 1136 times
-
- image2.png (81.16 KiB) Viewed 1136 times
Re: PixelSearch search area help
Hello and thank you for your reply.
There is nothing to image search, the health bar always changes. But the colors stay the same. That's why I was wondering how could I have a search area follow the health bar around and then use the search area to coord for my pixelsearch
Re: PixelSearch search area help
If the bar & bar's color are constant, then why will ImageSearch fail?
Re: PixelSearch search area help
@Saphile - You seem to be in the mindset of having to search for the entire health bar. What mikeyww is suggesting is that you search for a piece of the health bar that would always be the same, presumably a small section of the left end of it.
Re: PixelSearch search area help
Hello, and thank you for your suggestion.
The health bars colors change slightly based on the lighting in the game, so it's unfortunately not possible to use image search reliably @boiler the only way I can see it working is by having a search area follow the health box around, it would come in handy for me to get this script cause I can add other variables like certain alerts for magic and stamina too.
The health bars colors change slightly based on the lighting in the game, so it's unfortunately not possible to use image search reliably @boiler the only way I can see it working is by having a search area follow the health box around, it would come in handy for me to get this script cause I can add other variables like certain alerts for magic and stamina too.
Re: PixelSearch search area help
@mikeyww I was mistaken, the colors don't actually stay the same hex but to the eye they look the same. The lighting in the game also changes the hue of the health bar ever so slightly so image search doesn't work.
Re: PixelSearch search area help
It's also possible that there is a border around the health bar that is more constant, so it could be found via ImageSearch even if the colors inside of it change. Since you've only showed your rendering, we're just guessing and can only give you limited advice.