i need help with image search error.

07/08/2013 15:36 sander2828#1
i have looked for help through the forums but non of those have helped me out.

here is the code:
Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=0
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ImageSearch.au3>

HotKeySet("{p}", "checkForImage")

global $y = 0, $x = 0

Func checkForImage()
Local $search = _ImageSearch("Killed3.bmp", 1, $x, $y,1 )
If $search = 1 Then
MouseMove($x, $y, 10)
EndIf
EndFunc

while 1
sleep(200)
WEnd

this is the error:
Code:
\ImageSearch.au3 (44) : ==> Subscript used with non-Array variable.:
if $result[0]="0" then return 0
if $result^ ERROR

here are the pics i try to make it look for.
[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]
07/08/2013 16:16 butter123#2
the error is in the imagesearch.au3
has allready been asked few times in the forum
07/08/2013 16:28 sander2828#3
yup i know that but would be nice to figure out the fix.
because it sometimes gives error but sometimes it don't dunno why
i speak only english and estonian aswell so...

EDIT: and now agen when i changed pic to bmp 24 it works agen
07/08/2013 18:45 butter123#4
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
$result = DllCall("C:\ImageSearchDLL.dll","str","ImageSearch ","int",$x1,"int",$y1,"int",$right,"int",$bottom," str",$findImage)

; If error exit
if $result[0]="0" then return 0

; Otherwise get the x,y location of the match and the size of the image to
; compute the centre of search
$array = StringSplit($result[0],"|")

$x=Int(Number($array[2]))
$y=Int(Number($array[3]))
if $resultPosition=1 then
$x=$x + Int(Number($array[4])/2)
$y=$y + Int(Number($array[5])/2)
endif
return 1
EndFunc