hello everyone, again I turn to the community to learn something new
this image below is youtube video, the script is made in AHK, what impressed me is the accuracy that it returns to % of the character's energy bar
if in the GUI you put into the software click the work button if it has only 21% or more, it reads the value and performs the action if the percentage is valid.
but how could I do it in such a precise way?
Read the percentage of a power bar
Re: Read the percentage of a power bar
You can use ImageSearch to find a part of the unfilled-in portion of the power bar, which will tell you the location where the filled-in portion stops because the search is performed left-to-right. See this thread where this approach is discussed in detail. Your situation is even better because the numbers are not overlaid on top of the bar, so you can always be precise about its level.
After finding the position of where the filled in portion ends for each bar, it's just a matter of doing the math of dividing the length of the filled-in portion by the overall length.
After finding the position of where the filled in portion ends for each bar, it's just a matter of doing the math of dividing the length of the filled-in portion by the overall length.
-
- Posts: 24
- Joined: 29 Jul 2020, 17:11
Re: Read the percentage of a power bar
good logic, if we work on it, I find the already worn-out so (if any) as I would to find out exactly the beginning of the bar? since they would be two image search
Re: Read the percentage of a power bar
I would search for the little cap on the left end of the bar to find its starting location since that doesn’t change colors like the bar does.