Sign in to follow this  
Followers 0
Belfigor

Is there a way to make that script easier?

6 posts in this topic

#1 ·  Posted (edited)

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 :P. 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 :P

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 this post


Link to post
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 this post


Link to post
Share on other sites

#3 ·  Posted (edited)

It works!!! Thank you!

Now i just need to understand how it works :P

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 this post


Link to post
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.

post-34243-1218303850_thumb.jpg


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

Share this post


Link to post
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 this post


Link to post
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
Sign in to follow this  
Followers 0