Cykon Posted May 16, 2009 Share Posted May 16, 2009 (edited) First let me start off that I am writing a simple timer for a game. (Phantasy Star) To increase your stats in the game, you use an item every 3.35 minutes. I have a timer currently going to show up in the top left corner of my screen. I reset the timer by pressing the + sign on my keyboard. The only problem I have, is I can not use the hotkey while clicked onto the game's window. ex: Game is on windowed mode, hotkey from auto it does not work, click on my computers start button, press hotkey That is how I have been getting it to work. Any suggestions to make it so I can be in game and use the hotkey? Thanks expandcollapse popup$Seconds = 201 $on = 0 $paused = "Not Paused" HotKeySet("{NUMPADADD}", "Timer") HotKeySet("{NUMPADSUB}", "TimerPause") While 1 Sleep(100) WEnd Func Timer() if($on == 0) Then $on = 1 Local $Count = 0, $begin = TimerInit() While $Seconds > $Count $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") -1) $Count = int($dif/1000) ToolTip("Seconds Required = " & "201" & @CRLF & "Seconds Count = " & $Count & @CRLF & $paused , 0, 0, "PSO Mag Timer", 1) Sleep(20) WEnd if($paused == "Not Paused") Then MsgBox(64, "Time-Up!!", "Go feed that mag!") EndIf $on = 0 EndIf EndFunc Func TimerPause() if($paused == "Not Paused") Then $paused = "Paused" Else $paused = "Not Paused" EndIf EndFunc Edited May 16, 2009 by Cykon Link to comment Share on other sites More sharing options...
Inverted Posted May 16, 2009 Share Posted May 16, 2009 (edited) Most online games try to block keyboard hooks for anticheating. Test this : expandcollapse popup#Include <Misc.au3> $Seconds = 201 $on = 0 $paused = "Not Paused" HotKeySet("{NUMPADADD}", "Timer") ;HotKeySet("{NUMPADSUB}", "TimerPause") While 1 Sleep(100) WEnd Func Timer() if($on == 0) Then $on = 1 Local $Count = 0, $begin = TimerInit() While $Seconds > $Count $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") -1) $Count = int($dif/1000) ToolTip("Seconds Required = " & "201" & @CRLF & "Seconds Count = " & $Count & @CRLF & $paused , 0, 0, "PSO Mag Timer", 1) If _IsPressed("24") Then TimerPause() Sleep(50) WEnd if($paused == "Not Paused") Then MsgBox(64, "Time-Up!!", "Go feed that mag!") EndIf $on = 0 EndIf EndFunc Func TimerPause() if($paused == "Not Paused") Then $paused = "Paused" Else $paused = "Not Paused" EndIf EndFunc I replaced the second hotkey with an _IsPressed function inside that tooltip loop. Use the Home key to change from paused to not paused etc. Does it work ? Edited May 16, 2009 by Inverted Link to comment Share on other sites More sharing options...
Cykon Posted May 17, 2009 Author Share Posted May 17, 2009 The above method does work in game, thank you very much^^ It just changes extremely rapidly, but that can be fixed with an if statement =] Link to comment Share on other sites More sharing options...
Inverted Posted May 17, 2009 Share Posted May 17, 2009 Cool ! I usually just set the sleep a little higher and make sure I press the key quickly, ha !! 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