Jump to content
Sign in to follow this  
brad25

error: subsciipt used with non-array variable

Recommended Posts

brad25

i get this message on my laptop when running my script but not my desktop i was getting it on my desktop but must of fixed it now just on 2 other computers i get this error heres my code anyone no whats up?

func refresh()


    $scoord = PixelSearch( 2, 2, 1015, 350, 0x378f24)
    if not @error Then
        MouseMove ( $scoord[0], $scoord[1])
         sleep(1000)
        MouseClick("left")
        sleep(7000)
    EndIf

EndFunc 


func collect()


    $sscoord = PixelSearch( 114, 225, 932, 500, 0x8fbfd3)  
      if not @error Then
    MouseMove ( $sscoord[0], $sscoord[1] )
         sleep(1000)
        
        
        
        
        
    $ssscoord = PixelSearch( 1, 1, 28, 140, 0x1f91e1)
    
    MouseMove ( $ssscoord[0], $ssscoord[1])
    MouseClick("left")
    sleep(8000)
    


endif



$ss1coord = PixelSearch( 25, 225, 900, 500,  0x31024f)
         if not @error Then
         MouseMove ( $ss1coord[0], $ss1coord[1])
         sleep(1000)
    
    
    $sss2coord = PixelSearch( 498, 308, 712, 532, 0xe4b4ab)
         MouseMove ( $sss2coord[0], $sss2coord[1])
    MouseClick("left")
    sleep(8000)
    
    
    $ssss3coord = PixelSearch( 1, 1, 28, 140, 0x1f91e1)
         MouseMove ( $ssss3coord[0], $ssss3coord[1])
    MouseClick("left")
    sleep(8000)
    
    endif







EndFunc 












while 1
    Do
        refresh()
    
    until collect() 
    




wend

Share this post


Link to post
Share on other sites
JohnOne

See the way you have this pixelsearch ?

$scoord = PixelSearch( 2, 2, 1015, 350, 0x378f24)
    if not @error Then
        MouseMove ( $scoord[0], $scoord[1])
         sleep(1000)
        MouseClick("left")
        sleep(7000)
    EndIf

Well you need the rest of them like that, (error check) because anyone of them without it could give you that error.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
brad25

See the way you have this pixelsearch ?

$scoord = PixelSearch( 2, 2, 1015, 350, 0x378f24)
    if not @error Then
        MouseMove ( $scoord[0], $scoord[1])
         sleep(1000)
        MouseClick("left")
        sleep(7000)
    EndIf

Well you need the rest of them like that, (error check) because anyone of them without it could give you that error.

if i put the error check in each one it doesnt do Refresh()

Share this post


Link to post
Share on other sites
brad25

is there another way to check it for errors without using the if statment?

Share this post


Link to post
Share on other sites
omikron48

The fact that you want to 'check' something means that you'll want to test its value, hence the need to use a conditional statement, i.e. the If...Then..EndIf.

Edited by omikron48

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.