Recommended Posts

Hey,

I made a program which finds a number on the desktop based on colored pixels, and then makes a 2d array, with colored pixels represented by 1s.

I have a bunch of predefined 2d arrays, the same size, which represent all the possible numbers. I'd like to compare the one the program found to the predefined ones to find which number it is, but am having trouble.

Everytime it makes a comparison, it says it is true, whether it is or not. I really just need to know the syntax, and havnt been ablt to find it.

Any help is appreciated.

Thanks

Share on other sites

did you try

If \$a == \$b then ...

????

8) Share on other sites

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share on other sites

Thanks for the quick replies...

I did try that, but it doesn't seem to work.

Heres the code which finds the colored pixels and changes the values accordingly...

for \$x = 0 to 4

for \$y = 0 to 10

\$colored = PixelSearch ( \$x + \$topx1, \$y + \$topy, \$x + \$topx1, \$y + \$topy, 0xFF0000 , 100 )

If Not @error Then

\$Number[\$x][\$y] = 1

ElseIf

\$coord = PixelSearch ( \$x + \$topx1, \$y + \$topy, \$x + \$topx1, \$y + \$topy, 0x000000 , 100 )

If Not @error Then

\$Number[\$x][\$y] = 1

EndIf

Next

Next

I know that this works correctly, because I have a function which paints a visual representation, and it does match the number.

Then, I have 14 predefined arrays such as...

;Ace

Dim \$A

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 1

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 0

\$A = 0

\$A = 0

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 0

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 1

\$A = 0

Which represent the numbers. I'd like to compare the one found by the top code to the predefined ones to find out which is it.

Share on other sites

Oh, also, right now I'm using

if \$Number == \$A Then

Send("Ace")

to try and compare them, and it is saying that it is always true.

Share on other sites

Whoops, double post

Edited by KSagle

Share on other sites

Did you try matching each element of the arrays to see which ones match and which don't? You already know which should and shouldn't match, so maybe that will help you determine the source of your problem.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]