Recursive function causing my script to exit
When I call this function it runs for a few minutes and then the script
exits. I have found if I set the sleep period higher it takes longer for
it to exit. Are there any ways I can write this so that it never exits? I
think it has to do with the memory being used. The delay between loops has
to be 500ms or lower.
Waitbeforefight() ;Waiting period before you engage deady
{
Random, Wbf, 500, 500
sleep %Wbf%
ImageSearch, FoundX2, FoundY2, 855, 915, 1024, 1071, *30
E:\Desktop\Capture23.png
if ErrorLevel = 2
{
MsgBox Could not conduct the search.
ExitApp
}
else if ErrorLevel = 1
{
return
}
else
{
sleep %Wbf%
Waitbeforefight()
}
}
Even when I make a simple script like this it exits.
func1()
{
sleep 50
func1()
}
F1::
{
func1()
}
No comments:
Post a Comment