图片查找imagesearch这个东西好奇怪
Func _test()$result = _imagesearch("Source", 0, 0,600,800, "search", 40, 3, 1)
MsgBox(0,"",$result)
EndFunc
Func _Imagesearch($file, $x1, $y1 , $x2, $y2, $trans = "transblack", $variation = 60, $runs = 1, $behavior = 1)
If $behavior > 3 Or $behavior < 0 Then $behavior = 1
If $runs < 1 Or $behavior = 0 Then $runs = 1
Dim $aCoords[$runs] = ; just some number to make the _ArrayMax <-> _ArrayMin comparison work on it's first run
$findImage = '*' & $trans & ' ' & '*' & $variation & ' ' & $file & ".bmp"
$dll = DllOpen("imagesearchdll.dll")
While 1
$result = DllCall($dll, "str", "ImageSearch", "int", $x1, "int", $y1, "int", $x2, "int", $y2, "str", $findImage)
If $result = "0" Then
_ArrayPush($aCoords, 0, 1)
Else
_ArrayPush($aCoords, 1, 1)
If $behavior = 1 Then ExitLoop
EndIf
If _ArrayMax($aCoords) == _ArrayMin($aCoords) Then ExitLoop
Sleep(40)
WEnd
DllClose($dll)
If $aCoords = 1 Then
$array = StringSplit($result, "|")
Dim $aCoords = )), Int(Number($array)), Int(Number($array)) + Int(Number($array) / 2), Int(Number($array)) + Int(Number($array) / 2)]
Return ($aCoords)
Else
Return (0)
EndIf
EndFunc 可以帮我逐一的解释一下代码意思吗,
最好可以做一个例子。我看了许久也没能看出其中的奥秘,。。。。。上段的代码大概的意思我懂,就是很多细节看不明白,网上很难查的到,尤其对我这个没有基础的菜鸟来说更加困难,查都不知道从哪下手,版主,会员,和各路的无名高手能帮帮我吗 第3行里的SOURCE,和 SEARCH.各指的是什么呢? 还有为什么一运行就出错在第25行,所没有定义数组。。。。。。??帮个忙啊,我有很急用啊
页:
[1]