Jump to content

# Pixel search for gaming

## Recommended Posts

Hi all,

Im new here and i gotta admit AutoIt is cool and im just start learning it..

I've done alot reading (i just started learning yesterday) and dont understand much..

OK so i got part of a code from somewhere and modified the pixel value to the value i need.

Im searching for 2 pixel colour of 2 different thing, which one is for monster HP, and another item dropped.

So this coding will search for 1st item and click the coord and continue with the 2nd item...

Question

1. Could it be changed from 2 IF statement into 1 statement where "If xxxx or yyyy then Mouseclick coord" ??

2. And is it able to make a priority whereby if both pixel exists, the higher priority pixel will be clicked 1st? eg monster and item dropped will pickup item 1st only then kill monster.

3. Now i need AreaSearch of 5cmx5cm of centerscreen after pixelsearch found and clicked to the coord, how do i code it?

4. I dont understand what this argument is for "0,97,1019,569," the 3rd and 4th is the screen resolution but what's the 1st and 2nd value for?

```\$coord = Pixelsearch(0,97,1019,569, "12386304", 5, 1 )
If @error <> 1 then
Mouseclick("left",\$coord[0], \$coord[1],1,1)

Endif

sleep(3000)
\$coord = Pixelsearch(0,97,1019,569, "14066275", 5, 1 )
If @error <> 1 then
Mouseclick("left",\$coord[0], \$coord[1],1,1)

Endif```

I need all the help i can...

#### Share this post

##### Share on other sites

```\$coord = Pixelsearch(0,97,1019,569, "12386304", 5, 1 )
If @error <> 1 then
Mouseclick("left",\$coord[0], \$coord[1],1,1)
sleep(3000)
Else
\$coord = Pixelsearch(0,97,1019,569, "14066275", 5, 1 )
If @error <> 1 then
Mouseclick("left",\$coord[0], \$coord[1],1,1)
Endif```

Hmm would this make the priority?

#### Share this post

##### Share on other sites

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.

## 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

×

• Wiki

• Back

• Git