Jump to content

Need help here with pixelchecksum and arrays


Recommended Posts

hi guys, i need help here. hope someone can correct me.

i am writing a program whereby it will scan the screen for a particular color using "pixelsearch". after which it will then move the mouse to the location and do a "pixelchecksum" on the location which is a 13 x 13 square. but then when i do so, i get this error "Subscript used with non-Array variable". error occurs at the highlighted sentence.

can anyone point to me what's wrong? thanks, script as below ....

HotKeySet("!a", "StartLoop"); when Alt-a pressed, the loop will start

HotKeySet("!s", "QuitLoop"); when Alt-s is pressed, the loop will stop

HotKeySet("{ESC}", "_Quit") ; when ESC is pressed, exit the script

Func StartLoop()

$start = 1 ; setting the condition

EndFunc ;==>StartLoop

While 1

If $start Then ; Start looping continuously until button press (Main Body)

mapalignmentcheck()

EndIf

Sleep(20)

WEnd

Func mapalignmentcheck() ; checking the aligment of the map

Send("m")

Sleep(1000)

$col = pixelsearch(0,100,1020,765,0x4A3110,0) ; looking for a unique color on the map tab as landmark

If Not @error Then

$xy = Mousemove($col[0],$col[1]); move mouse to the location

$var = PixelChecksum($xy[0],$xy[1],$xy[1]+13,$xy[0]+13)

Tooltip("Checksum = " &$var)

EndIf

Sleep(5000)

EndFunc

Func QuitLoop()

$start = 0 ; setting the condition

EndFunc ;==>QuitLoop

Func _Quit()

Exit

EndFunc ;==>_Quit

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