ihenvyr Posted April 14, 2006 Share Posted April 14, 2006 This timer behaves like this: Pressing "T" starts 4 minutes countdown while pressing "T" again it adds 4 minutes.. as i observed, the countdown timer in "seconds" is decreasing and skipping fast when i continually pressing "T" to add time.. IS IT NORMAL? or IS THERE SOMETHING WRONG WITH THIS SCRIPT? i've noticed that hitting "T" 15 times is have a result of 59min 30 below, i think adding time while decreasing time in seconds made a conflict.. HELLO have you encountered someone like this? Please help.. HotKeySet("t", "ADD_TO_TIMER") Dim $ADDTIME = "", $TIME_WAS_ADDED, $TIMER, $MY_TIME_LEFT Func ADD_TO_TIMER() If Not $ADDTIME <> "" Then Send("p") $ADDTIME = 4 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 4 + ($MY_TIME_LEFT / 60) EndIf EndFunc;==>ADD_TO_TIMER While 1 ; SCRIPT HERE If $TIME_WAS_ADDED = 1 Then $DIFF = TimerDiff($TIMER) / 1000 $MY_TIME_LEFT = ($ADDTIME * 60) - $DIFF If $MY_TIME_LEFT <= 0 Then Send("p") $TIME_WAS_ADDED = 0 $ADDTIME = "" $MY_TIME_LEFT = "" EndIf EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $MY_TIME_LEFT / 60 , Mod($MY_TIME_LEFT , 60)), 0, 0) Sleep(100) WEnd Umbrella Member Link to comment Share on other sites More sharing options...
Developers Jos Posted April 14, 2006 Developers Share Posted April 14, 2006 If Not $ADDTIME <> "" Then should be: If Not ($ADDTIME <> "") Then or even simply: If $ADDTIME = "" Then 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 More sharing options...
ihenvyr Posted April 14, 2006 Author Share Posted April 14, 2006 If Not $ADDTIME <> "" Then should be: If Not ($ADDTIME <> "") Then or even simply: If $ADDTIME = "" Then HotKeySet("t", "ADD_TO_TIMER") Dim $ADDTIME = "", $TIME_WAS_ADDED, $TIMER, $MY_TIME_LEFT Func ADD_TO_TIMER() If Not ($ADDTIME <> "") Then Send("p") $ADDTIME = 4 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 4 + ($MY_TIME_LEFT / 60) EndIf EndFunc;==>ADD_TO_TIMER While 1 ; SCRIPT HERE If $TIME_WAS_ADDED = 1 Then $DIFF = TimerDiff($TIMER) / 1000 $MY_TIME_LEFT = ($ADDTIME * 60) - $DIFF If $MY_TIME_LEFT <= 0 Then Send("p") $TIME_WAS_ADDED = 0 $ADDTIME = "" $MY_TIME_LEFT = "" EndIf EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $MY_TIME_LEFT / 60 , Mod($MY_TIME_LEFT , 60)), 0, 0) Sleep(100) WEnd still not working.. it should work like this: adding 4 minutes should not affect the seconds for example 3:59 7:58 11:57 15:56 19:55 i think there's something wrong with here->> $ADDTIME = 4 and-->> $ADDTIME = 4 + ($MY_TIME_LEFT / 60) or---->> $MY_TIME_LEFT = ($ADDTIME * 60) - $DIFF ..but i'm not familiar with that script please all experts help me with this.. thanks.. Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 14, 2006 Moderators Share Posted April 14, 2006 What do you mean your not familiar with it, I wrote it for you 6 months ago! You've had all this time to do some studying in the help file!!!! It subtracts the time that has already passed... This script hasn't changed since I wrote it, what have you done to try and fix the issue you 'think' your having, show me some effort, and I might try to do something different to help. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 14, 2006 Share Posted April 14, 2006 (edited) Hi, not very good, but maybe it helps. HotKeySet("t", "ADD_TO_TIMER") HotKeySet("{F2}", "end") Dim $min = 0, $sec = 60, $start = False, $first_S = False Func ADD_TO_TIMER() If $first_S = False Then $min += 3 $first_S = True $start = True Else $min += 4 $start = True EndIf EndFunc ;==>ADD_TO_TIMER While 1 If $start = True Then $sec -= 1 If $sec = 0 Then $sec = 59 $min -= 1 EndIf EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $min, $sec), 0, 0) Sleep(1000) WEnd Func end() Exit (0) EndFunc ;==>end So long, Mega Edited April 14, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
ihenvyr Posted April 14, 2006 Author Share Posted April 14, 2006 (edited) Hi, not very good, but maybe it helps. HotKeySet("t", "ADD_TO_TIMER") HotKeySet("{F2}", "end") Dim $min = 0, $sec = 60, $start = False, $first_S = False Func ADD_TO_TIMER() If $first_S = False Then $min += 3 $first_S = True $start = True Else $min += 4 $start = True EndIf EndFunc;==>ADD_TO_TIMER While 1 If $start = True Then $sec -= 1 If $sec = 0 Then $sec = 59 $min -= 1 EndIf EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $min, $sec), 0, 0) Sleep(1000) WEnd Func end() Exit (0) EndFunc;==>end So long, Mega Hello! thanks for all the help the default start time is 0 minute(s) 60 second(s) here i edit to become 0 minutes(s) 0 second(s) start time.. i've noticed that when time reaches 0 minute(s) 0 second(s) it keeps subtracting minute and seconds, resulting to negative value.. how to make it stop when minute and seconds reaches zero(0)?? ..in order to add time again here HotKeySet("t", "ADD_TO_TIMER") HotKeySet("{F2}", "end") Dim $min = 0, $sec = 0, $start = False, $first_S = False Func ADD_TO_TIMER() If $first_S = False Then $min += 3 $sec += 60 $first_S = True $start = True Else $min += 4 $start = True EndIf EndFunc;==>ADD_TO_TIMER While 1 If $start = True Then $sec -= 1 If $sec = 0 Then $sec = 59 $min -= 1 ElseIf $min = 0 And $sec = 0 Then;is it correct? ;what will be the next script here? please help EndIf EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $min, $sec), 0, 0) Sleep(100);i reduced it in order to reach zero minute and seconds quickly WEnd Func end() Exit (0) EndFunc;==>end JdeB please help ..thanks th.meger any help? please.. Edited April 14, 2006 by ihenvyr Umbrella Member Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 14, 2006 Share Posted April 14, 2006 HI, something like this? expandcollapse popupHotKeySet("t", "add4Min") HotKeySet("{F2}", "end") Dim $min = 0, $sec = 60, $start = False, $first_S = False, $finish_S = False Func add4Min() If $first_S = False Then $min += 3 $first_S = True $start = True Else $min += 4 $start = True EndIf $finish_S = False EndFunc ;==>add4Min While 1 If $finish_S = False Then If $start = True Then $sec -= 1 If $sec = 0 Then $min -= 1 If $min = 0 Then $finish_S = True EndIf $sec = 59 EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $min, $sec), 0, 0) Else ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', 0, 0), 0, 0) EndIf Else ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s) - FINISHED!!!', 0, 0), 0, 0) $first_S = False EndIf Sleep(1000) WEnd Func end() Exit (0) EndFunc ;==>end So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
ihenvyr Posted April 14, 2006 Author Share Posted April 14, 2006 HI, something like this? expandcollapse popupHotKeySet("t", "add4Min") HotKeySet("{F2}", "end") Dim $min = 0, $sec = 60, $start = False, $first_S = False, $finish_S = False Func add4Min() If $first_S = False Then $min += 3 $first_S = True $start = True Else $min += 4 $start = True EndIf $finish_S = False EndFunc ;==>add4Min While 1 If $finish_S = False Then If $start = True Then $sec -= 1 If $sec = 0 Then $min -= 1 If $min = 0 Then $finish_S = True EndIf $sec = 59 EndIf ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', $min, $sec), 0, 0) Else ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s)', 0, 0), 0, 0) EndIf Else ToolTip('TIME LEFT: ' & StringFormat('%i minute(s) and %i second(s) - FINISHED!!!', 0, 0), 0, 0) $first_S = False EndIf Sleep(1000) WEnd Func end() Exit (0) EndFunc ;==>end So long, Mega Yup!! absolutely something like that.. thank you very very much th.meger!! ..thank you for your time! Umbrella Member 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