Ask gaming related questions
4 posts • Page 1 of 1
I am trying to find a dot of color within a range of my screen and do some basic inputs when it isn't present. It's color is random, but consistently is the only thing with a red value of 255. PixelSearch can detect varying colors, but there are other colors of red values close, such as 240, that make it impossible to account for the ranges the pixel can reach in the green and blue values. Is there any way to do something akin to PixelSearch where I can check only a specific value within the color?
You would probably need to do a PixelGetColor across the range, and then check the red values.
Exactly how fast is PixelGetColor? And how fast can it then compare red values? If I could effectively emulate PixelSearch with for loops and GetColor, and then invidivually compare upwards of about 5000 pixel values to 255, then I could pheasibly make it work. But if the search would take more than about 10ms, then it's likely the red blob I'm looking for will have shifted somewhere else entirely. I'm effectively trying to catch a bullet in a photograph. It needs to be instant. I could capture all of the colors first, append them to an array, then compare them afterwards to check if it was in the search, ect. I get what you're saying and it makes sense, but I'm not sure it would work in practice due to the precision I need to ensure no false positives.
Also, I don't know right now how to compare color values like this. My first instinct would be converting the color value into a string, removing the other colors, then comparing them, but if that's too hacky, I'd appreciate if you or anyone else has a better method for this.
Edit: This solution is unlikely to work. I have tested the capabilities of PixelGetColor to find it goes astronomically slow. Even checking 100 pixels by themselves, without any operations like saving values or anything else, takes WAY WAY too long to do, let along the several thousand that would be required. I may test some kind of hexagonal pixel packing strategy for one that doesn't have to check as much, as I am looking for an amorphous blob that will more than likely take up a decent size.
You can always capture a screenshot and analyze it. Best of luck.