Is there a way to make that script easier?

Recommended Posts

I made a script, that will read pixels from screen and add coords of all black pixels to an array and after it compare new coords of found black pixels with old coords. Dont know how to tell, but will try:

1. I have a letter. I know where on screen that letter will appear, and i know coordinates of all black pixel in the letter. I have array where i add that coords.

2. I scan part of screen, and add to new array coords of all black pixels

3. I compare new coords with coords that i have before.

This script is working, but is there a way to make it easier? I need to change EndIf with something else . May be it is possible compare an arrays? I dont know how to make it, help please.

```Dim \$JC[2][13] = [[698, 699, 700, 701, 702, 702, 702, 702, 702, 702, 702, 702, 702],[451, 452, 452, 452, 443, 444, 445, 446, 447, 448, 449, 450, 451]]
Dim \$array[2][30]
\$x = 697
\$y = 438
\$COLOR = 0x000000
\$i = 0
\$Pix = 0
\$J = 0

Search()
JTest()
Func Search()
For \$xi = 0 to 6
For \$yi = 0 to 19
If PixelGetColor(\$x, \$y) = \$COLOR Then
\$array[0][\$Pix] = \$x
\$array[1][\$Pix] = \$y
\$Pix = \$Pix +1
EndIf
\$y = \$y+1
Next
\$y = 438
\$x = \$x+1
Next
EndFunc

Func JTest()
If \$array[0][0] = \$JC[0][0] Then
If \$array[0][1] = \$JC[0][1] Then
If \$array[0][2] = \$JC[0][2] Then
If \$array[0][3] = \$JC[0][3] Then
If \$array[0][4] = \$JC[0][4] Then
If \$array[0][5] = \$JC[0][5] Then
If \$array[0][6] = \$JC[0][6] Then
If \$array[0][7] = \$JC[0][7] Then
If \$array[0][8] = \$JC[0][8] Then
If \$array[0][9] = \$JC[0][9] Then
If \$array[0][10] = \$JC[0][10] Then
If \$array[0][11] = \$JC[0][11] Then
If \$array[0][12] = \$JC[0][12] Then
If \$array[1][0] = \$JC[1][0] Then
If \$array[1][1] = \$JC[1][1] Then
If \$array[1][2] = \$JC[1][2] Then
If \$array[1][3] = \$JC[1][3] Then
If \$array[1][4] = \$JC[1][4] Then
If \$array[1][5] = \$JC[1][5] Then
If \$array[1][6] = \$JC[1][6] Then
If \$array[1][7] = \$JC[1][7] Then
If \$array[1][8] = \$JC[1][8] Then
If \$array[1][9] = \$JC[1][9] Then
If \$array[1][10] = \$JC[1][10] Then
If \$array[1][11] = \$JC[1][11] Then
If \$array[1][12] = \$JC[1][12] Then
MsgBox(0, "Found letter", '"J"')
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc```

It dont work

Edited by Belfigor

[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Share on other sites

Im not 100% sure but i suppose this should work :

```Dim \$JC[2][13] = [[698, 699, 700, 701, 702, 702, 702, 702, 702, 702, 702, 702, 702],[451, 452, 452, 452, 443, 444, 445, 446, 447, 448, 449, 450, 451]]
Dim \$array[2][30]
\$x = 697
\$y = 438
\$COLOR = 0x000000
\$i = 0
\$Pix = 0
\$J = 0

Search()
if JTest() Then MsgBox(0, "Found letter", '"J"')
Func Search()
For \$xi = 0 To 6
For \$yi = 0 To 19
If PixelGetColor(\$x, \$y) = \$COLOR Then
\$array[0][\$Pix] = \$x
\$array[1][\$Pix] = \$y
\$Pix = \$Pix + 1
EndIf
\$y = \$y + 1
Next
\$y = 438
\$x = \$x + 1
Next
EndFunc  ;==>Search

Func JTest()
for \$1=0 to 12
if \$array[0][\$1] = \$JC[0][\$1] Then
if \$array[1][\$1] = \$JC[1][\$1] Then
if \$1 = 12 Then Return True
Else
ExitLoop
EndIf
Else
ExitLoop
EndIf
Next
Return False
EndFunc  ;==>JTest```

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight!

Share on other sites

It works!!! Thank you!

Now i just need to understand how it works

Edited by Belfigor

[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Share on other sites

Is there a way to make a script that will find a picture on the screen?

I have a picture on the screen an i whant to make a script that will tell me when he found that picture on the screen in game.

[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Share on other sites

Is there a way to make a script that will find a picture on the screen?

I have a picture on the screen an i whant to make a script that will tell me when he found that picture on the screen in game.

Look at Image Search Library

http://www.autoitscript.com/forum/index.php?showtopic=65748

But I'm not sure if it works in (fullscreen) games - I think NO.

Share on other sites

Look at Image Search Library

http://www.autoitscript.com/forum/index.php?showtopic=65748

But I'm not sure if it works in (fullscreen) games - I think NO.

Thank you! I will try

[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Create an account

Register a new account