Jump to content

Recommended Posts

Posted

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.

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
  • Developers
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

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

Posted

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

Posted

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
  • Developers
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

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

Posted

@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

Posted

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

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

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
Posted

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

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...