Jump to content

Stack overflow


faldo
 Share

Recommended Posts

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

  • Developers

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 ?

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

Link to comment
Share on other sites

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

 

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