I'm kind of new to AHK so I will do my best to outline my problem clearly.
I've got a macro I made for training skill within a game. It's crude but gets the job done. What I wanted to do was use FindText script in order to look out for a fail message, which I could then program in extra repeats of previous steps.
I downloaded and ran FindText script - captured my image - tested it via the script itself and sure enough it finds my fail message if I trigger it at the moment the message appears in-game.
I then tried to take the code it gives me and incorporate into my own script however I can't get it working at all now. I course be massively misunderstanding it's use... My script is as follows:
Code: Select all
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
}
Code: Select all
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