Jump to content
Sign in to follow this  

Measuring the distance between 2 points

Recommended Posts


I'm trying to develop an auto-potter that my friend has requested. I used to play the same game as he, but I have gotten tired of it and have moved on to WoW :party:. Anyways, I want to try and make an auto-potter that 'technically' pots according to the actual health remaining number. I gave Memory a shot, but I found out recently the memory address for health on the game is dynamic and is constantly changing. So I have thought it out, but unsure on one part in my idea.

Here is how I am thinking it out so far [REFER TO THE PICTURE BELOW... THE RED AREA IS THE HEALTH]

(Heres the idea, I'll explain the problem in a bit)

1. Have the health bar (in picture) measured from its tallest and its lowest point.

- Say I have a MAX Health of 10,000

2. Have it divide the distance between the tallest and lowest points by 2. Now the middle of the health bar would be 5,000 Health.

3. Keep dividing until it reaches 1 health. (So next divide by 2 would = 2,500 then 1,250... etc)

4. Now the bot will know where a certain health is at on the HP bar.

5. So if my friend types in that he wants it to heal at 1,111... It would PixelGetColor at the coordinate of 1,111 HP. Once the red color no longer exists in that area, it uses a potion.

Now my problems :S

#1 from above: How could I have this measured? If others use this eventually, they may not have the same screen resolution or they might be on windowed instead of full screen mode vice versa, etc. I thought they could pick the tallest and lowest points on the HP bar, but they may not be perfect (even off 10 coordinates, could mess the potter up drastically).

Of course I CAN get the exact distance between the tallest and lowest, but the PixelGetColor (from #5) might be looking at the wrong spot due to different resolutions/windowed or full mode. (I suppose if this can't be fixed, I could just make 4 versions ><)

And I just wanted to ask... Do you think this is possible to do? I'm pretty sure I can figure out the math algorithm to break it down to 1 coordinate on the health part, but would it be possible to actually do?

I really don't have a script to show you, as I haven't started... I wanted to know if it would be even possible to do before I got half way through and find out it won't work :).

Thanks a bunch for any advice.


Share this post

Link to post
Share on other sites

I'm surprised people still play CO2. It sucks.

Here is a script that will help.

I put in comments so that hopefully you can learn something from using it. :)

Basicaly, you just open CO then put your mouse over where you want the script to pot. Once you have made up your mind just press the 'HOME' key.

Once pressed, if the color of that pixel changes it will press f12.

(Note that if you hit alt+tab, it will recognise the pixel as different and mash f12. Probably best to make a while loop with "While WinActive("[Conquer]2.0") " as an expression.)

HotKeySet("{HOME}", "_GetHP")

Global $Color = 0
Global $Pos[2]

    ; Do nothing until you have chosen a normal color.
Until $Color <> 0 ;Color has been chosen

While 1 ; loop forever
    If _HPChanged($Color) Then _Pot()
    Sleep(20) ;Wait a bit

Func _GetHP()
    $Pos = MouseGetPos()
    $Color = PixelGetColor($Pos[0], $Pos[1]) ; Set the normal HP color.
EndFunc   ;==>_GetHP

Func _HPChanged($Color)
    $NewColor = PixelGetColor($Pos[0], $Pos[1]) ; Get the current HP color.
    If $NewColor <> $Color Then Return True ; If the current and normal colors are differnt, hp HAS changed.
    Return False ; There were no changed to the HP
EndFunc   ;==>_HPChanged

Func _Pot()
    Send("{F12}") ; Press 'f12' or what ever you have pot on.
EndFunc   ;==>_Pot
Edited by disc330

Still learning...I love autoit. :)

Share this post

Link to post
Share on other sites

Thanks, I actually have my own auto-potter that does the same... And uses pot Boxes as well :). I just wanted a more exact method of doing it.

And yea Conquer sucks, WoW pwns xD.

Share this post

Link to post
Share on other sites

There is much better methods, I recall using NomadMemory.au3 and CheatEngine to use memory addresses. Sadly now I have some privileges issues and cant play around with that anymore.

Its really the way to go if you want a quick and effective way of potting.

Still learning...I love autoit. :)

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