Sign in to follow this  
Followers 0
namedrisk

Logic to make a percent from a value

3 posts in this topic

Hi,

i was thinking on how to get a percent from this piece of code but i couldnt get it to the paper:

$MobHP = PixelSearch(736,48,910,49,0x3F3830,3) ; 173 pixels of hp
If Not @error Then ;If pixel has been found to $coord
   $MobHPvalue = 909 - $MobHP[0]
EndIf

So if you see the piece of code i will get X every time i find the image i want the image i am looking for is an Health Bar that goes down from the right to the left so the value i get from 909 - X is from 0 to 173 since 909 - 736 = 173.

So my question is how could i make it a 99% to 1% as it substracts it self to 173

1 = 99% and 173 = 0%

i could make it by checking if X is bigger then X_new and small then X_next and create % by hand but it would look so ugly that i would like to find a new better way of doing it

thanks for any help in advance :D

Share this post


Link to post
Share on other sites



'(173 - x) / 173'?

Share this post


Link to post
Share on other sites

Thank you very much for the fast reply don't belive i didnt came to that ...

(173 - $MobHPvalueX) / 173 * 100

just did the trick thanks a lot ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0