Dinosaurr Posted December 31, 2008 Share Posted December 31, 2008 $AutoHeal = 1 $HealPotTimer = TimerInit() While 1 If $AutoHeal = 1 And TimerDiff($HealPotTimer) >= 5000 Heal() $HealPotTimer = TimerInit() EndIF WEnd Func Heal() WinActivate("Untitled - Notepad") Send("z") EndFunc Im not looking for you to critique the code, im just looking to see why its not working. This isn't even the code im using so im not even sure if it works. Im just trying to give an example of what im trying to do. Now on to the problem. It will only send the z key once after the timer has went off. How can i reset the timer so it will repeatedly call the function ever 5 sec? Link to comment Share on other sites More sharing options...
Achilles Posted December 31, 2008 Share Posted December 31, 2008 $AutoHeal = 1 $HealPotTimer = TimerInit() While 1 If $AutoHeal = 1 And TimerDiff($HealPotTimer) >= 5000 Heal() $HealPotTimer = TimerInit() EndIF WEnd Func Heal() WinActivate("Untitled - Notepad") Send("z") EndFunc Im not looking for you to critique the code, im just looking to see why its not working. This isn't even the code im using so im not even sure if it works. Im just trying to give an example of what im trying to do. Now on to the problem. It will only send the z key once after the timer has went off. How can i reset the timer so it will repeatedly call the function ever 5 sec?One you add a "then" in your "if-then" statement this segment of code will actually run. When it runs, it does trigger every 5 seconds like it's supposed to. $AutoHeal = 1 $HealPotTimer = TimerInit() While 1 If $AutoHeal = 1 And TimerDiff($HealPotTimer) >= 5000 then Heal() $HealPotTimer = TimerInit() EndIF WEnd Func Heal() WinActivate("Untitled - Notepad") Send("z") EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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