Jump to content

Non-Array variable?


layer
 Share

Recommended Posts

i get this error, whats wrong?:

MouseClick ("left", $coord [0], $coord [1], 1, 0)

Error: Subscript used with non-Array variable.

heres the full code:

HotKeySet("^!x", "MyExit")

while 1

$coord = PixelSearch(0, 0, 724, 556, 0xBD9E4A, 0, 30)

$coorda= PixelSearch(0, 0, 724, 556, 0x313018, 0, 25)

If Not @error Then

MouseClick ("left", $coord [0], $coord [1], 1, 0)

MouseClick ("left", $coorda [0], $coorda [1], 1, 0)

EndIf

wend

Func MyExit()

Exit

EndFunc

help plz!

FootbaG
Link to comment
Share on other sites

wait a sec, im still getting the same error, heres the new code:

HotKeySet("^!x", "MyExit")

while 1

$coord = PixelSearch(0, 0, 724, 556, 0xBD9E4A, 0, 30)

$coorda= PixelSearch(0, 0, 724, 556, 0x313018, 0, 25)

If Not @error Then

MouseClick ("left", $coord [0], $coord [1], 1, 0)

MouseClick ("left", $coorda [0], $coorda [1], 1, 0)

EndIf

if @error then

MouseClick ("left", $coord [0], $coord [1], 1, 0)

MouseClick ("left", $coorda [0], $coorda [1], 1, 0)

endif

wend

Func MyExit()

Exit

EndFunc

whats wrong now!?

FootbaG
Link to comment
Share on other sites

sry larry, i hate to bother you again =( but it still doesn't work, but when i get the error, it points to the "[0]" part, i don't know why, any other suggestions larry, thanks agaiN! =D

FootbaG
Link to comment
Share on other sites

Maybe this will help:

HotKeySet("^!x", "MyExit")

while 1
  $coord = PixelSearch(0, 0, 724, 556, 0xBD9E4A, 0, 30)
  $err = @error
  $coorda= PixelSearch(0, 0, 724, 556, 0x313018, 0, 25)
  If Not @error And Not $err Then
     msgbox(0,"",$coord)
     MouseClick ("left", $coord [0], $coord [1], 1, 0) 
     MouseClick ("left", $coorda [0], $coorda [1], 1, 0)
  Else
     MsgBox(0,"Not Found", "Pixel Was Not Found On Screen")
     ExitLoop
  EndIf
wend

Func MyExit()
  Exit 
EndFunc

The problem is your if logic still tries to access $coord and $coordA if they are NOT arrays.

*** Matt @ MPCS

Edited by Matt @ MPCS
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...