Jump to content

recursion level exceeded? need help


Recommended Posts

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")

Pause()

Func Begin()
    WinActivate ( "SwgClient" )
    Sleep ( "3000" )
      Start()
EndFunc

Func Start()
      MouseClick ( "right" , 281, 308 , 1 , 1 ) 
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 ) 
      Sleep ( "1200" )
      MouseClick ( "right" , 281, 308 , 1 , 1 ) 
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 ) 
      Sleep ( "1200" )
   Start()
EndFunc

Func Pause()
   Sleep ( "10000" )
    Pause()
EndFunc

Func MyExit()
    Exit
EndFunc

here is the error i recieve:

line 0 (file path here)

Sleep ( "1000" )

Error: Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.

can anyone tell what the problem is? this macro is designed to run repeatedly for really long periods of time.

thanks,

Beemer

Link to comment
Share on other sites

try this

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")

Pause()

Func Begin()
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
   While 1
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
EndFunc

Func Pause()
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by burrup

qq

Link to comment
Share on other sites

ok i can understand this... now with this new code how does it keep repeating itself?

If I understand (sorry , I don't speak english ... shame on me) your question is to know why the 2nd code is all right

The difference beetwen your code and Burrup's code is that your function call the same function again and again, so the system need memory for each call.

Burrup's code stays in the same function, and doesn't need more memory

Is it what you wonder ?

Link to comment
Share on other sites

#define AUT_MAXEXECUTERECURSE   384             // Maximum number of times the Execute() function can recurse to itself

Hardcoded... This just gets more fun every day. :)

Edited by Smed

601DisengageEnd Program

Link to comment
Share on other sites

hey, sry i coudlnt assist you, if you want ANY code to repeat to itself you use a While..Wend loop like this

While 1
;Insert Code Here
Wend

That will loop the code an infinite amount of times unless u tell it to exit or close or wateva

edit: actaullyt ill put comments in the first code

When you put something in a Function it doesnt perform the code until the function is called, in this case your functions are called until you press a designated hotkey, until then they lay dormant

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")

Pause();This will "pause" your code, actaully it just repeats *nothing* over and over                   
           ;to give the imitation

Func Begin(); If u press Ctrl+Alt+Z this wil happen
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
;----------------------------------------------
   While 1; It will repeat the code  seperated an infinite amount of times
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
;----------------------------------------------
EndFunc

Func Pause(); When you press Ctrl+Alt+X The script will be pu in an infinite loop   
                   ;again
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by burrup

qq

Link to comment
Share on other sites

#define AUT_MAXEXECUTERECURSE   384             // Maximum number of times the Execute() function can recurse to itself

Hardcoded... This just gets more fun every day. :)

<{POST_SNAPBACK}>

Its hard-coded so AutoIt can give a soft error (Inform the user with a messagebox) instead of a hard error in which the infamous Application Crash dialog appears since if this goes unchecked, it literally crashes AutoIt.
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...