FifteenFifty Posted August 27, 2006 Posted August 27, 2006 Error: recursion level has been exceeded - Autoit will quit to prevent stack overflow any ideas how to fix it anyone?
amanda089 Posted August 27, 2006 Posted August 27, 2006 Error: recursion level has been exceeded - Autoit will quit to prevent stack overflowany ideas how to fix it anyone?Take a good look at your loops, you have an infinite loop somewhere.
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 (edited) i have, its not infinite, it stops when it finds a colour is gone but sometimes it takes a while \edit so i need it to keep going until it finds the colour is gone Edited August 27, 2006 by FifteenFifty
Developers Jos Posted August 27, 2006 Developers Posted August 27, 2006 (edited) Take a good look at your loops, you have an infinite loop somewhere.Not really a loop, but a Func calling itself either directly or indirectly...There are several posts with an explanation ...just search for them... Edited August 27, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 yeah there is a func that calls itself but it stops calling itself when it finds the colour is gone it goes like this Func _func () Sleep (1000) Pixelsearch (xxxxxxxx) If Not @error then Mouseclick (xxxxxx) _func () EndIf If @error Then _check () EndIf EndFunc
MHz Posted August 27, 2006 Posted August 27, 2006 Normally caused by a function being called within itself, so it keeps recurring until it reaches the 384 limit. like this would just keep recurring function() Func function() function() EndFunc
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 so instead of it calling itself should i make it call another function that clicks then calls the _func () again?
MHz Posted August 27, 2006 Posted August 27, 2006 At all costs, yes. It is poor coding to call a function within itself as it is illogical to get into that habit.
Developers Jos Posted August 27, 2006 Developers Posted August 27, 2006 (edited) so instead of it calling itself should i make it call another function that clicks then calls the _func () again?Nope... will give the same error.. If you want the code to repeat constantly you create a Loop with While...Wend. While 1 _Func() WEnd Func _func() Sleep(1000) PixelSearch(xxxxxxxx) If Not @error Then MouseClick(xxxxxx) EndFunc ;==>_func Edited August 27, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 thx, i won't do it again now i know that it throws an error after a while and it's poor coding
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 @JdeB it needs to loop until the colour is gone, which is not forever, when the colour is gone it runs a load of other funcs and stuff, the colour going is just the start
Helge Posted August 27, 2006 Posted August 27, 2006 so instead of it calling itself should i make it call another function that clicks then calls the _func () again?If I understood that sentence correctly and if you worded as you meant to, then I have to say that I think that would just make it even messier. Anyway, it's kind of hard to work without knowing what _check() does but if you haven't done anything crazy there as well then this might work:Func _func () While 1 Sleep (1000) Pixelsearch (xxxxxxxx) If Not @error Then Mouseclick (xxxxxx) Else ExitLoop EndIf WEnd _check () EndFunc
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 (edited) sounds good Helge, i'll try it now \edit it works thanks very much for the help all and a Big thanks to Helge Edited August 27, 2006 by FifteenFifty
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 (edited) ok, i got another error, more funcs calling themselves. Func _radar () PixelSearch (894,655,989,739,16726065) If Not @error Then _radar1 () EndIf If @error Then Send ("{q down}") Sleep (2000) Send ("{q up}") _radar () EndIf EndFunc \edit you can see that if it can't find the colour it holds q for a bit until it comes into view, so i have no idea how to make this not call itself Edited August 27, 2006 by FifteenFifty
Helge Posted August 27, 2006 Posted August 27, 2006 Ok... just do as I did, and put that "recall- or continue-part" in a loop, and replace the function-calling with the actual stuff you want to happen. Making the snake bite his own tail isn't necessary...
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 how do you mean? sorry, you lost me i know what you mean for me to do but i dno how to do it
Helge Posted August 27, 2006 Posted August 27, 2006 Func _radar () While 1 PixelSearch (894,655,989,739,16726065) If Not @error Then ContinueLoop Send ("{q down}") Sleep (2000) Send ("{q up}") WEnd EndFunc
FifteenFifty Posted August 27, 2006 Author Posted August 27, 2006 (edited) thx, that should work, once again you have saved my life /edit but how do i get it to call _radar1 ()? you think this would work (i just wrote it) Func _radar () While 1 PixelSearch (894,655,989,739,16726065) If @error Then Send ("{q down}") Sleep (2000) Send ("{q up}") EndIf Else ExitLoop WEnd _radar1 () EndFunc Edited August 27, 2006 by FifteenFifty
Helge Posted August 27, 2006 Posted August 27, 2006 I just noticed after I posted it that the function has no way to escape and that the script is trapped inside that function. I only changed your script so you would have to add an Return or ExitLoop somewhere..
Helge Posted August 27, 2006 Posted August 27, 2006 Is this what you meant to code ?Func _radar() While 1 PixelSearch(894, 655, 989, 739, 16726065) If @error Then Send("{q down}") Sleep(2000) Send("{q up}") Else ExitLoop EndIf WEnd _radar1 () EndFunc But still, you don't get the point. You are calling a function inside the very same function. The _radar() has NO way of escaping. Start reading from the top of the function and try to follow the path a script would follow...tell me when you're finished
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now