2014-12-08 33 views
-3

它发现在选定区域的岩石,但似乎只是点击其中一个,并将光标悬停在其他岩石上,直到同样的岩石回来。有人可以看我的脚本,并告诉我什么是错的?我正在使用AutoIt。这里是我的脚本:我试图制作一个矿工机器人使用Autoit为RuneScape

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

我认为这是一个解决方案:

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 
相关问题