ihenvyr Posted November 8, 2005 Share Posted November 8, 2005 Hi to all!! its me again.. i have a plan of making a timer script, but i have no idea how to begin with.. its a timer script which: for example, when pressing "T" time counts down lets say counts down for 5 minutes.. then.. when time is up it blocks the keyboard/mouse input. ..and if you keep pressing "T" it also keep adding 5 minutes while counting down.. its sound pretty advance to me as a newbie.. Help please ..thanks!! Umbrella Member Link to comment Share on other sites More sharing options...
BigDod Posted November 8, 2005 Share Posted November 8, 2005 Search the forums for timer, you will be amazed at what you find.Here is one I found that could possibly be modified to do what you want. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
WHRobin566 Posted November 8, 2005 Share Posted November 8, 2005 (edited) Hi to all!!its me again..i have a plan of making a timer script,but i have no idea how to begin with..its a timer script which:for example, when pressing "T"time counts down lets saycounts down for 5 minutes..then.. when time is upit blocks the keyboard/mouse input...and if you keep pressing "T"it also keep adding 5 minuteswhile counting down..its sound pretty advanceto me as a newbie.. Help please ..thanks!!HotKeySet("T", "TIMERADD") HotKeySet("{F1}", "TIMERSTAR") $timeon = 0 $time = 0 Func TIMERADD() $time = $time + 1 MsgBox(1, "Time", "1 Min added!", 1) EndFunc Func TIMERSTAR() If $timeon = 1 Then $timeon = 0 MsgBox(1, "Timer off", "Timer is off!", 1) ElseIf $timeon = 0 Then $timeon = 1 MsgBox(1, "Timer on", "Timer is on!", 1) EndIf EndFunc While 1 If $timeon = 1 Then $time = $time - 1 BlockInput(0) Sleep(60000) If $time = 0 Then MsgBox(1, "Beep", "Timer went off!", 1) BlockInput(1) $timeon = 0 SoundSetWaveVolume(100) SoundPlay("") #comments-start Put the path and name of sound and extension in soundplay box! #comments-end EndIf EndIf WEndTimer.au3 Edited November 8, 2005 by WHRobin566 Witch Hunter Robin Link to comment Share on other sites More sharing options...
ihenvyr Posted November 8, 2005 Author Share Posted November 8, 2005 HotKeySet("T", "TIMERADD") HotKeySet("{F1}", "TIMERSTAR") $timeon = 0 $time = 0 Func TIMERADD() $time = $time + 1 MsgBox(1, "Time", "1 Min added!", 1) EndFunc Func TIMERSTAR() If $timeon = 1 Then $timeon = 0 MsgBox(1, "Timer off", "Timer is off!", 1) ElseIf $timeon = 0 Then $timeon = 1 MsgBox(1, "Timer on", "Timer is on!", 1) EndIf EndFunc While 1 If $timeon = 1 Then $time = $time - 1 BlockInput(0) Sleep(60000) If $time = 0 Then MsgBox(1, "Beep", "Timer went off!", 1) BlockInput(1) $timeon = 0 SoundSetWaveVolume(100) SoundPlay("") #comments-start Put the path and name of sound and extension in soundplay box! #comments-end EndIf EndIf WEndthanks but..time doesn't counts downand doesn't add....its soooooo confusing EXPERTS PLEASE HELP Umbrella Member Link to comment Share on other sites More sharing options...
BigDod Posted November 8, 2005 Share Posted November 8, 2005 Did you look at the one that I pointed you to ? It does a countdown of sorts. I am sure if you studied it to see exactly what it does you could modify it to suit. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
ihenvyr Posted November 8, 2005 Author Share Posted November 8, 2005 Did you look at the one that I pointed you to ?It does a countdown of sorts. I am sure if you studied it to see exactly what it does you could modify it to suit.Yes BigDod, but it says:AutoIt ErrorLine 20tooltip("Timer = " & int($tdif) & " Minutes",0,0,"", 5)^ERRORstill can't modify because of that.. Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 8, 2005 Moderators Share Posted November 8, 2005 Kind of crude, but try this: HotKeySet("t", "ADD_TO_TIMER") Dim $ADDTIME = "", $TIME_WAS_ADDED, $TIMER, $MY_TIME_LEFT Func ADD_TO_TIMER() If Not $ADDTIME <> "" Then $ADDTIME = 5 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 5 + $MY_TIME_LEFT EndIf EndFunc ;==>ADD_TO_TIMER While 1 ; SCRIPT HERE If $TIME_WAS_ADDED = 1 Then $DIFF = TimerDiff($TIMER) / 1000 / 60 $MY_TIME_LEFT = $ADDTIME - $DIFF If $MY_TIME_LEFT <= 0 Then BlockInput(1) $TIME_WAS_ADDED = 0 $ADDTIME = "" $MY_TIME_LEFT = "" MsgBox(0, '', 'BLOCKED AND EXITING', 3) Exit EndIf EndIf ToolTip("TIME LEFT = [ " & Round($MY_TIME_LEFT) & " ]" & " minutes left", 0, 0) Sleep(100) WEnd 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...
ihenvyr Posted November 9, 2005 Author Share Posted November 9, 2005 Kind of crude, but try this:HotKeySet("t", "ADD_TO_TIMER") Dim $ADDTIME = "", $TIME_WAS_ADDED, $TIMER, $MY_TIME_LEFT Func ADD_TO_TIMER() If Not $ADDTIME <> "" Then $ADDTIME = 5 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 5 + $MY_TIME_LEFT EndIf EndFunc ;==>ADD_TO_TIMER While 1 ; SCRIPT HERE If $TIME_WAS_ADDED = 1 Then $DIFF = TimerDiff($TIMER) / 1000 / 60 $MY_TIME_LEFT = $ADDTIME - $DIFF If $MY_TIME_LEFT <= 0 Then BlockInput(1) $TIME_WAS_ADDED = 0 $ADDTIME = "" $MY_TIME_LEFT = "" MsgBox(0, '', 'BLOCKED AND EXITING', 3) Exit EndIf EndIf ToolTip("TIME LEFT = [ " & Round($MY_TIME_LEFT) & " ]" & " minutes left", 0, 0) Sleep(100) WEndThank You Very Much ronsrules!! i'll gonna try to modify it according to my needs.. More Power to all!! Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 9, 2005 Moderators Share Posted November 9, 2005 Good Deal Were you able to modify it to suit your needs? 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...
ihenvyr Posted November 9, 2005 Author Share Posted November 9, 2005 Good Deal Were you able to modify it to suit your needs? ..i can'tsoo hard for me..id keep pressing "t" till reaches 30 minutesbut after 10 or 15 minutes passed/deductedit keeps subtracting 5 minutes if you keep pressing "t"why is it happening? PS:about tooltips,is it possible to see it clearly without flickering duringfullscreen games? or any recommendation other thantooltips to see the timer details without flickering?Thanks Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 9, 2005 Moderators Share Posted November 9, 2005 The example I gave you doesn't flicker for me... Why don't you post exactly what you did. I tested it last night with an auto shut off, for 90 minutes, and it did it. (Using "t" to add 5 minutes to 90 minutes). 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...
ihenvyr Posted March 19, 2006 Author Share Posted March 19, 2006 (edited) hi i'm back its been a long time since... here it is my script.. please i need some help The scenario is like this: The game started as PAUSE, you have to press hotkey "T" to send "P" in order to resume game -at the same time, it starts to count down from 2 minutes ......and while continue to press hotkey "T" it adds another 2 minutes and another 2 minutes ..and so on.. note: no sending "P" while adding time.. on the other side, if timer reaches ZERO "0" it will send "P" again to PAUSE the game.. Please help me about this guys.. or some recommendations.. there is something wrong about sending "P".. thanks 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 = 2 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 2 + $MY_TIME_LEFT EndIf EndFunc;==>ADD_TO_TIMER While 1 ; SCRIPT HERE If $TIME_WAS_ADDED = 1 Then $DIFF = TimerDiff($TIMER) / 1000 / 60 $MY_TIME_LEFT = $ADDTIME - $DIFF If $MY_TIME_LEFT <= 0 Then Send("p") $TIME_WAS_ADDED = 0 $ADDTIME = "" $MY_TIME_LEFT = "" EndIf EndIf ToolTip("TIME LEFT = [ " & Round($MY_TIME_LEFT) & " ]" & " minutes left", 0, 0) Sleep(100) WEnd Edited March 19, 2006 by ihenvyr Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 19, 2006 Moderators Share Posted March 19, 2006 Are you sure there is something wrong with sending 'p', or is your game just not excepting the send command? (What game is it, maybe someone here can tell you). 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...
ihenvyr Posted March 19, 2006 Author Share Posted March 19, 2006 (edited) yes there is something wrong .. it doesnt' send "P".. i use an emulator called M.A.M.E (Multiple Arcade Machine Emulator) the default key for PAUSE is "P".. ..and i test it by opening notepad and it doesn't send neither.. please help.. Edited March 19, 2006 by ihenvyr Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 19, 2006 Moderators Share Posted March 19, 2006 (edited) yes there is something wrong .. it doesnt' send "P".. i use an emulator called M.A.M.E (Multiple Arcade Machine Emulator) the default key for PAUSE is "P".. ..and i test it by opening notepad and it doesn't send neither.. please help.. This worked for me: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 = 2 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 2 + $MY_TIME_LEFT 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 Run('Notepad.exe') WinWaitActive('Untitled - Notepad') 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) WEndOf course you have to actually click 't' to activate it. It openened notepad, and sent 'p' to notepad. Edit: You do realize that you are sending 'p' twice right? Edit2: Added an actual count down tracker with Minutes and Seconds. Edited March 19, 2006 by SmOke_N 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...
ihenvyr Posted March 19, 2006 Author Share Posted March 19, 2006 thank you very much!!! it work! ..pressing "T" adds 2 minutes, pressing "T" again adds another 2 minutes ..and so on but when i press "T" twice the time changed to 120+ minutes instead of 4 minutes.. press "T" trice the time changed to 1200+ minutes instead of 12 minutes. ..hoping for you m8 thanks Umbrella Member Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 20, 2006 Moderators Share Posted March 20, 2006 (edited) thank you very much!!! it work! ..pressing "T" adds 2 minutes, pressing "T" again adds another 2 minutes ..and so on but when i press "T" twice the time changed to 120+ minutes instead of 4 minutes.. press "T" trice the time changed to 1200+ minutes instead of 12 minutes. ..hoping for you m8 thanksHotKeySet("t", "ADD_TO_TIMER") Dim $ADDTIME = "", $TIME_WAS_ADDED, $TIMER, $MY_TIME_LEFT Func ADD_TO_TIMER() If Not $ADDTIME <> "" Then Send("p") $ADDTIME = 2 $TIME_WAS_ADDED = 1 $TIMER = TimerInit() Else $ADDTIME = 2 + ($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 Run('Notepad.exe') WinWaitActive('Untitled - Notepad') 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) WEndJust forgot to fixe the $ADDTIME = 2 + $MY_TIME_LEFT Else statement when I changed the timer settings. Edited March 20, 2006 by SmOke_N 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...
ihenvyr Posted April 14, 2006 Author Share Posted April 14, 2006 (edited) as i observed, the countdown timer in "seconds" is decreasing fast when i continually pressing "T" to add time.. IS IT NORMAL? or IS THERE SOMETHING WRONG WITH THIS SCRIPT? 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 Please some ideas.. Edited April 14, 2006 by ihenvyr 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