# a user built pixelsearch

## Recommended Posts

Making my own pixelsearch function is simple using two nested fornext loops. Only I'm not totally sure how to do the math on the variation optional parameter.

There are several questions all concerning the mathematical nature of RGB color, and the syntactical requirements of displaying it. I realize that on a count 16 system like hex, the codes work basically like so...

0123456789abcdef

and then in three doubledigit pairs of two signifying 'intensity'

00 00 00

R G B

That is on a scale of 1-255 per color. So using the count 16 system there are 255 possibilities per doubledigit section. That signifies the hue of that particular color. So...

ff001f = 255-00-17

or 255 parts R,

0 parts green,

17 parts blue.

In all my autoit programs I've stuck to using decimal color codes because I don't have to convert them.

Now however, I've gotten to a point where I want to write a custom pixelsearch function, only I don't understand how the decimal version works BECAUSE....

Rather then having 6 digits such as hex, dec has up to 7 digits. Example = 8023390

now...I am assuming that there are two groups of two digits, and one group of three. If that is the case, how do I tell which is the group of three?

8023390 could be

80 233 90

or 80...shit heh

I think I just answered my own question. there is only one possibility for 8023390. That is 80 233 90. The other two 'ways'

802 33 90

80 23 390 don't work because one of the groups is OVER the 255 limit. If that is the case with ALL dec colors I will be very happy. If anyone has more information on this topic that I missed, or bungled up please post a 'fixer' reply so that everyone gets the right idea. Ty.

##### Share on other sites

What how do you tell for codes that could go both ways....as there are some that do. Such as..1513228

that could be

R G B

151 32 28

15 132 28

15 13 228

How do I tell which it is?

##### Share on other sites

No, no no. You have it all wrong.

Firstly, Hexadecimal is a numbering system that uses 16 as its base. Because it requires 16 symbols, the letters A to F are used as digits to represent the decimal numbers 10 to 15.

Decimal on the other hand refers to numbers in base 10. 10 fingers on your hand . And it doesn't necessarily have to have a decimal point in it. Numbers with decimal points (that is, numbers with a fractional part) are called fixed-point or floating point numbers.

Secondly, you need to get the notation out of your brain about...

```1513228 decimal
that could be
R G B
151 32 28
15 132 28
15 13 228```

As its totally incorrect as the they are 2 totally different formats as one uses base 16 and the other base 10.

Thirdly, AutoIt has functions that can convert this for you anyway lol. Look up in the help file, Hex() and Dec().

Hope you understand,

Burrup

Edited by Burrup

qq

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...