Jump to content

Recursion level has been exceeded


Recommended Posts

I checked around using the search button and I noticed the solution varies from script to script so I figured I should post mine here so you guys can have a look:

Help please.

Usually happens when the script's already running for a while.

en5bot.au3

Edited by en5bot
Link to comment
Share on other sites

I checked around using the search button and I noticed the solution varies from script to script so I figured I should post mine here so you guys can have a look:

Help please.

Usually happens when the script's already running for a while.

You need to let your functions complete and return. You are calling new functions from inside of functions and never letting them finish. After you have called about 384 functions without letting them finish, AutoIt shuts down the program because the recursion level has been exceeded. You need to restructure your script so your functions can return.

The best way to do this is to make a main function which calls all of your other functions. THen when a called function is finished, it can return to the main function so another functions can be called. You can use variables and set conditions to determine what function needs to be called.

Nomad :D

Link to comment
Share on other sites

You need to let your functions complete and return. You are calling new functions from inside of functions and never letting them finish. After you have called about 384 functions without letting them finish, AutoIt shuts down the program because the recursion level has been exceeded. You need to restructure your script so your functions can return.

The best way to do this is to make a main function which calls all of your other functions. THen when a called function is finished, it can return to the main function so another functions can be called. You can use variables and set conditions to determine what function needs to be called.

Nomad :D

Oh, I see, thanks

But is there any chance you can give me an example for a function that doesnt finish and how to call it from the script? just for additional understanding.

Thanks in advance.

Link to comment
Share on other sites

Oh, I see, thanks

But is there any chance you can give me an example for a function that doesnt finish and how to call it from the script? just for additional understanding.

Thanks in advance.

Global $v

Func Main ()
 Select
  Case $v = 1
   Func_1 ()
  Case $v = 2
   Func_2 ()
  Case $v = 3
   Func_3 ()
  Case $v = 4
   Exit
 EndSelect
EndFunc

Func Func_1 ()
 If 1 = 1 Then
  $v = 2
 Else
  $v = 3
 EndIf
EndFunc

Func Func_2 ()
 If 1 = 2 Then
  $v = 1
 Else
  $v = 3
 EndIf
EndFunc

Func Func_3 ()
 If 1 = 2 Then
  $v = 2
 Else
  $v = 4
 EndIf
EndFunc

That's an example way to structure your script.

Nomad :D

Link to comment
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
 Share

  • Recently Browsing   0 members

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