Sign in to follow this  
Followers 0
faldo

Stack overflow

6 posts in this topic

#1 ·  Posted (edited)

How do i check a value every 0.5 seconds to see if it has changed, without getting a stack overflow? Maybe there is some way to reset the "Recusion level"? :S

Func Check()    
    Sleep(500)
        if $Value > 1 Then
            nextfunction()
        Else
            check()
        EndIf
EndFunc
Edited by faldo

Share this post


Link to post
Share on other sites



How do i check a value every 0.5 seconds to see if it has changed, without getting a stack overflow?

Func Check()    
    Sleep(500)
        if $Value > 1 Then
            nextfunction()
        Else
            check()
        EndIf
EndFunc
First of all, you are calling the Check function recursively as long as $Value less or equal 1 and this is done until you called it the maximal times.

How is the variable $Value set ?


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

#3 ·  Posted (edited)

How is the variable $Value set ?

The value is gathered from outside the script and is changeing all the time, when it becomes a 2 or over, this script should react and do something else.

Is there a way to do such "check" nonrecursively?

Edited by faldo

Share this post


Link to post
Share on other sites

another option might be adlib for example

AdlibEnable("Check",500)

Func Check()    
 if $Value > 1 Then
  AdlibDisable()
  nextfunction()
 EndIf
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanx w0uter, "while" worked good... adlib still gives the recusion error.

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