Sign in to follow this  
Followers 0
blublub

noarray variable problem

3 posts in this topic

#1 ·  Posted (edited)

my func looks like this

$szukaj2 = Pixelsearch(4,76,631,490,$kolor,1,1)
        $znajdz2 = @error
        If $znajdz2=1 then 
            $szukaj2 = Pixelsearch(631,178,802,592,$kolor,1,1)
            $znajdz2=@error
            If $znajdz2=1 Then
                $szukaj2 = Pixelsearch(198,25,665,76,$kolor,1,1)
                $znajdz2=@error
            EndIf
        EndIf
        If $znajdz2=0 Then
            Mouseclick("left",$szukaj2[0],$szukaj2[1],1,1)
                Endif

why is it if the color will be in the 2 or 3 square i get the error :

==> Subscript used with non-Array variable.

why theres no szukaj[1] or szukaj[2] when found color in the 2 or 3 in $szukaj2 it works only with first when theres no if

does it has to be some global declaration its in the same function if thats it how ill declare just the $szukaj2 or the $szukaj[0] and $szukaj[1]

Edited by blublub

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$szukaj2 = Pixelsearch(4,76,631,490,$kolor,1,1)
        If @error = 1 then 
            $szukaj2 = Pixelsearch(631,178,802,592,$kolor,1,1) ;There was a typo in this line?
            If @error = 1 Then
                $szukaj2 = Pixelsearch(198,25,665,76,$kolor,1,1)
            EndIf
        EndIf
        If IsArray($szukaj2) Then
            Mouseclick("left",$szukaj2[0],$szukaj2[1],1,1)
        Endif

An IsArray should fix your problem. Also I think there was a typo in your code.

Edited by mikehunt114

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


Link to post
Share on other sites

if it wont find color $znajdz will be 1 so it coudnt perform the mouseclick it finds it and then it crashes

if ill add If IsArray($znajdz2) before the If $znajdz2=0 it will just wont perform the click becouse its not an array i know that...

but tell me why its not an array when it shoudl be theres something wierd with pixelsearch if will do soemthing else befoire going to an if to perform soemthing with coords it will wipe out them

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