yucatan 0 Posted January 25, 2011 Hello guys i'm using this script to count from 10 to zero. i wanne make it like this that if it reaches 10 that the counter restart. but i dont know how i need to do that. some help Pleas? Thanks alot. $count_down_time = 1 ;sec $corected_time = $count_down_time * 1000 $timer = TimerInit() Global $display_old while 1 $display = Floor(($corected_time-TimerDiff($timer))/1000) if $display <> $display_old Then ConsoleWrite($display&@CRLF) $display_old = $display EndIf ;~ == end of display countdown part === if TimerDiff($timer)>= $corected_time Then exit EndIf WEnd Share this post Link to post Share on other sites
jaberwacky 327 Posted January 25, 2011 (edited) Something like this? $count_down_time = 1 ;sec $corected_time = $count_down_time * 1000 $timer = TimerInit() Global $display_old Global $counter = 0 While 1 $counter += 1 $display = Floor(($corected_time - TimerDiff($timer)) / 1000) If $display <> $display_old Then ConsoleWrite($display & @CRLF) $display_old = $display EndIf ;~ == end of display countdown part === If TimerDiff($timer) >= $corected_time Then Exit EndIf If $counter = 10 Then $COunter = 0 EndIf WEnd Edit* DOH! I forgot to count down from ten. Edited January 25, 2011 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Share this post Link to post Share on other sites
yucatan 0 Posted January 25, 2011 script is the same.... it needs to count down from 5 to 0 if it has reaches 0 then start again from 5 to 0/ Share this post Link to post Share on other sites
wakillon 403 Posted January 25, 2011 (edited) script is the same.... it needs to count down from 5 to 0 if it has reaches 0 then start again from 5 to 0/ Like this ? $timer = TimerInit() Global $display_old=1 while 1 $display = Floor ( TimerDiff ( $timer ) ) If $display <> $display_old Then ConsoleWrite(5-$display&@CRLF) $display_old = $display EndIf ;~ == end of display countdown part === If TimerDiff($timer)> 5 Then $timer = TimerInit() EndIf WEnd Edited January 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
yucatan 0 Posted January 25, 2011 timer goes much to fast. it count down but not every second. Share this post Link to post Share on other sites
wakillon 403 Posted January 25, 2011 (edited) timer goes much to fast. it count down but not every second. Sorry it was milliseconds, now it's seconds ! $timer = TimerInit() Global $display_old=1 while 1 $display = Floor ( TimerDiff ( $timer )/1000 ) If $display <> $display_old Then ConsoleWrite(5-$display&@CRLF) $display_old = $display EndIf If TimerDiff($timer)/1000 > 5 Then $timer = TimerInit() WEnd Edited January 25, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites