它找到所选区域中的岩石,但似乎只是点击其中一个并将光标悬停在其他区域上,直到相同的岩石回来。有人可以看看我的剧本并告诉我什么是错的?我正在使用AutoIt。这是我的剧本:
HotKeySet("{ESC}", "terminate")
HotKeySet("!c", "getColor")
HotKeySet("!a", "attackLoop")
Global $color
Global $interval
$interval = "10000"
MsgBox(0, "Starting Up", "Starting, use ESCAPE to quit, Alt + C to set color, and Alt + A to attack.")
Func Terminate()
Exit 1
EndFunc
Func getcolor()
$point = MouseGetPos()
$color = PixelGetColor($point[0], $point[1])
MsgBox(0, "Color Set", "The color has been set to " & $color)
EndFunc
Func attackloop()
MsgBox(0, "Mining", "Starting to mine")
While 1
$point = PixelSearch(37, 74, 1313, 892, $color)
if IsArray($point) Then
MouseClick("right", $point[0], $point[1])
Sleep($interval)
ContinueLoop
EndIf
WEnd
EndFunc
While 1
Sleep($interval)
WEnd
答案 0 :(得分:0)
我认为这是一个解决方案:
HotKeySet("{ESC}", "terminate")
HotKeySet("!c", "getColor")
HotKeySet("!a", "attackLoop")
Global $color, $count
Global $interval = 10000
Dim $point1[2]
MsgBox(0, "Starting Up", "Starting, use ESCAPE to quit, Alt + C to set color, and Alt + A to attack.")
Func Terminate()
Exit 1
EndFunc
Func getcolor()
$point = MouseGetPos()
$color = PixelGetColor($point[0], $point[1])
MsgBox(0, "Color Set", "The color has been set to " & $color)
EndFunc
Func attackloop()
$on = 1
MsgBox(0, "Mining", "Starting to mine")
While $on = 1
$point1 = PixelSearch(37, 74, 1313, 892, $color)
If not @error Then
MouseClick("right", $point1[0], $point1[1])
Sleep($interval)
EndIf
If @error Then
$count = $count + 1
EndIf
If $count > 5 Then
$on = 0
EndIf
WEnd
EndFunc
While 1
Sleep($interval)
WEnd