Jump to content

Pixel search


Backnor
 Share

Recommended Posts

I would like to thank everyon in advance. I am wanting to know if I can have pixel search look for a range of colours or do I need to name each pixel that may be present?

This is what I have so far

$Target0X = 32

$Target0Y = 100

$No_Target_Col = 0 ; Black

$Target1X = 63

$Target1Y = 100

$No_Target_Col = 0 ; Black

$Target2X = 105

$Target2Y = 100

$No_Target_Col = 0 ; Black

$Good_To_Go = 0x02E800 ; Health Good

$Good_To_Go = 0x02D800 ; Health Good

$Target_Colour = PixelGetColor ($Target0X, $Target0Y)

IF $Target_Colour = $No_Target_Col Then

Send ("{1}")

$Target_Colour = PixelGetColor ($Target1X, $Target1Y)

IF $Target_Colour = $No_Target_Col Then

Send ("{2}")

$Target_Colour = PixelGetColor ($Target2X, $Target2Y)

IF $Target_Colour = $No_Target_Col Then

Send ("{3}")

IF $Target_Colour = $Good_To_Go Then

$Fight = 1

EndIf

Endif

EndIf

EndIf

I am trying to read pixel colours of an in game health bar, I want it to read the first target area and if it returns as black then to do a big heal the next would be a smaller heal and so on. If it reads the health colour as good then it will move on to the fighting part of the script.

The problem is that the healthbar uses many differant pixel colours

Link to comment
Share on other sites

  • Moderators

PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

Just use the "Right/Bottom" the same as "left/top"

left = x

top = y

So as an example:

$Target0X = 32
$Target0Y = 100
$aPix = PixelSearch($Target0X, $Target0Y, $Target0X, $Target0Y, 0x02E800, 20)
If IsArray($aPix) Then
    MsgBox(64, "info", "Found")
EndIF

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...