我是AHK的新手,所以我会尽力清楚地概述我的问题。
我有一个宏可以用来训练游戏中的技能。这很粗糙,但是可以完成工作。我想做的是使用FindText脚本来查找失败消息,然后我可以对之前的步骤进行额外的重复编程。
我下载并运行了FindText脚本-捕获了我的图像-通过脚本本身对其进行了测试,并确定如果在消息出现在游戏中时立即触发它,它将找到我的失败消息。
然后,我尝试使用它提供的代码并将其合并到我自己的脚本中,但是我现在无法完全使用它。我当然会误会它的用途...我的脚本如下:
SendMode Input
;hotkey bindings
Med = 5
Hiding = 2
Spell = 7
Lockpick = 1
Key_One = 8
Key_Two = 9
LastTarg = t
TargSelf = z
Forward = w
Backward = s
;what we're looking for - the lockpick fail message
t1:=A_TickCount
Text:="|<Failed Text>**50$69.Vy20000nU1xyDkE0008409AF220001TU1BXBkE000+M0DYNMT0UU3OzXwVvDSD702QSTYalUN880HUuAYaNt9B0PznRYlXP99c3H3NgX8GR9B0ODvBYP2Gh9c3FlNgVMGJ9B0O9vB4P2Pd9c3FDNcXQNtBtUP9vxw0VUNUU011621oDA7j0C7TrTDUT0C01kBvzw"
F4::Pause
F3::
Loop,
{
Loop, 1
{
;Chest one + Hiding
SendHotkey(Hiding)
Sleep, 1000
SendHotkey(Forward)
Sleep, 500
SendHotkey(Backward)
Sleep, 500
SendHotkey(Lockpick)
Sleep, 500
CoordMode, Mouse, Screen
Click, left, 1509, 736
Sleep, 4500
if (ok:=FindText(0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Text))
{
MsgBox OK
}
Sleep, 7500
;Chest two
SendHotkey(Lockpick)
Sleep, 500
CoordMode, Mouse, Screen
Click, left, 1540, 738
Sleep, 4000
;We then want to lock the chests again
;Chest One
SendHotkey(Key_One)
Sleep, 1500
CoordMode, Mouse, Screen
Click, left, 1509, 736
Sleep, 1500
;Chest two
SendHotkey(Key_Two)
Sleep, 1500
CoordMode, Mouse, Screen
Click, left, 1540, 738
Sleep, 1500
}
}
SendHotkey(Hotkey)
{
DefaultSleep = 100 ; default sleep for keypress
Lag = 100 ; adjust for lag
Window = Legends of Aria
ControlFocus, , %Window%
ControlSend, , {%Hotkey% down}{}, %Window%
DllCall("Sleep", "UInt", Lag)
ControlSend, , {%Hotkey% up}{}, %Window%
Sleep DefaultSleep
return
}
来自FindText的图像:
0____000000_____0_________________________00__000__________00000_0000
00___000000_____0________________________0______0__________0__0__00__
_0___0____0_____0________________________0_000000__________0__00_00__
_00__00_000_____0________________________0_0__00___________00000__0__
_00__0_00____00000______0_____0_________00_00_0_0000000___000000__0__
__0000_00__0000_0000___0000___000__________0__000___0000__000000__0__
0__00_00___00______00__0__0_____0__________0__000_____000_0___00__0__
0__0__00__00__0000__0__0__0__00_0_______00_0000000000__00_000_00__0__
00___00___00_00_00__0__0__0__00_0_______00_0__00____00_00__00_00__0__
_00__0____0__0__000_0__0__0__00_0_______00_0___0000000_00__00_00__0__
_00_00____0__0__0_0_00_0__0__00_0_______00_0___000___0_00__00_00__0__
__0_00____0__0__0_0_0__0__0__00_0_______00_0___0__0000_00__00_0___0__
_00_00____0__00_000_0__0__0__00_0_______00_0___0__0000_00__00_0___0__
_00_000___00__0000__0__00_0000__00______00_00__0__0000_000000_00000__
______0____00______00__00_____0________________0_____0___00_____0____
__000_0____0000__00_____0000_0000________000____000_0000000_000_00000
__00000______00000________000____________000______00_0000_00000000000