SaphuA Posted August 14, 2008 Share Posted August 14, 2008 (edited) Hello, Quick question here. Is it possible to have a certain function called every x-interval? And even better; is it possible during a while loop aswell? Kinda like this: SetInterval(DoThis, 200) while true ; Do this wend func DoThis ; And this endfunc Edited August 14, 2008 by SaphuA http://www.saphua.com/ Link to comment Share on other sites More sharing options...
JRowe Posted August 14, 2008 Share Posted August 14, 2008 You can read timestamps, and execute functions in order throughout a loop, or you can place Sleep(200) between your functions. The timer option is probably what you're after. Simply read the time and check it against a "last checked" variable. If enough time has passed since the last check, then execute your function, otherwise continue through the loop. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Alek Posted August 14, 2008 Share Posted August 14, 2008 a simple example executing ;Do stuff every 1 sec global $Interval_Timer = timerinit() while 1 If TimerDiff($Interval_Timer) > 1000 Then ;Do stuff $Interval_Timer = timerinit() EndIf ;Do normal stuff WEnd [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 15, 2008 Share Posted August 15, 2008 It sounds to me that he wants AdlibEnable() and not some timer. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
SaphuA Posted August 15, 2008 Author Share Posted August 15, 2008 (edited) It sounds to me that he wants AdlibEnable() and not some timer.Yep seems like it. Both sollutions are very usefull. Thanks everyone! Edited August 15, 2008 by SaphuA http://www.saphua.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now