Sign in to follow this  
Followers 0
FifteenFifty

Help with error please

24 posts in this topic

Error: recursion level has been exceeded - Autoit will quit to prevent stack overflow

any ideas how to fix it anyone?

Share this post


Link to post
Share on other sites



Error: recursion level has been exceeded - Autoit will quit to prevent stack overflow

any ideas how to fix it anyone?

Take a good look at your loops, you have an infinite loop somewhere.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by FifteenFifty

Share this post


Link to post
Share on other sites

#4 ·  Posted (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...

:P

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

so instead of it calling itself should i make it call another function that clicks then calls the _func () again?

Share this post


Link to post
Share on other sites

At all costs, yes. It is poor coding to call a function within itself as it is illogical to get into that habit.

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

thx, i won't do it again now i know that it throws an error after a while and it's poor coding :P

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

sounds good Helge, i'll try it now

\edit it works :P thanks very much for the help all and a Big thanks to Helge

Edited by FifteenFifty

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 by FifteenFifty

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

how do you mean? sorry, you lost me :P i know what you mean for me to do but i dno how to do it

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

thx, that should work, once again you have saved my life :P

/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 by FifteenFifty

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

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 :P

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0