ImageSearch Error

03/01/2013 15:04 -[Frame]*#1
Hallo Leute,

ich wollte ein Pixel bot für S4 League machen, allerdings kommt immer ein Error.

Hier ist das Script:
Quote:
#RequireAdmin
#include <ImageSearch.au3>

HotKeySet("{Numpad1}", "_start")
HotKeySet("{Numpad2}", "_exit")

$x1 = 0
$y1 = 0
$pause = False
While 1
sleep(10)
WEnd

Func _start()
$pause = Not $pause
If $pause Then
$result = _ImageSearch("free.png", 1, $x1, $y1, 0)
If $result = 1 Then
While 1
MouseMove($x1, $y1)
MouseClick("LEFT")
WEnd
Else
MsgBox(64, "Error!", "Something went wrong")
While 1
Sleep(10)
WEnd
EndIf
EndIf
EndFunc

Func _exit()
Exit
EndFunc

Error:
[Only registered and activated users can see links. Click Here To Register...]

Das bild was er suchen soll:
[Only registered and activated users can see links. Click Here To Register...]
03/01/2013 15:46 Croco™#2
Das ist ein Fehler in der ImageSearch.au3.
Dort wird versucht in Zeile 40 auf ein leeres Array zu zugreifen.

Änder mal das hier (Zeile 40 ImageSearch.au3):
Quote:
if $result[0]="0" then return 0
in das hier ab:
Quote:
if not IsArray($result) then
return 0
elseif $result[0]="0" then
return 0
EndIf
03/01/2013 16:51 -[Frame]*#3
Danke, jetzt kommt wenigstens schonmal die Fehlermeldung die ich angegeben habe.
Was muss ich da jetzt machen?
03/01/2013 22:16 Croco™#4
Naja der Fehler kommt daher dass, das Script das Img nicht findet darum "result 0".
Versuch mal kleiner Bilder zu nehmen da meines Wissens nach es da keine Toleranz bei der suche gibt.
03/02/2013 16:08 butter123#5
bei mir musste ich den speicherort der imagesearch.au3 anders angeben damits läuft. und ich glaube imagesearch hat auch probleme wenn mans mit 64 bit startet.
03/03/2013 14:03 -[Frame]*#6
Soll in den Pfad in der Include einbauen oder wie?
03/03/2013 15:54 butter123#7
ja ich hab den pfad in der include geändert glaub ich. da steht schon einer drin und den dann ändern. und natürlich die dll dahin verschieben
03/03/2013 19:00 -[Frame]*#8
Könntest du mir ein Beispiel machen?
03/03/2013 19:15 butter123#9
PHP Code:
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $xByRef $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