[Function] Timer

Post gaming related scripts
FanaticGuru
Posts: 776
Joined: 30 Sep 2013, 22:25

[Function] Timer

07 Nov 2013, 18:57

[Function] Timer

Below is a function I use often in my gaming scripts to keep track of timers. Generally the cooldown on abilities which is prevalent in many games.

The function is easy to use and not as complicated as the comments at the beginning might imply.

Code: [Select all] [Expand] [Download] (Timer.ahk)GeSHi © Codebox Plus



A practical gaming example.

Code: [Select all] [Expand] [Download] (Timer_Example.ahk)GeSHi © Codebox Plus


You have 5 abilities called Bash, Thrash, Trash, Slash, Crash with different cooldowns that are activated by the keys 1 2 3 4 5.
Push or hold down F1 to use any ability that is off cooldown.

The Timer function has a lot of versatility that is explained in the comments of the function.

FG
Last edited by FanaticGuru on 24 May 2014, 01:07, edited 1 time in total.
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
FanaticGuru
Posts: 776
Joined: 30 Sep 2013, 22:25

Re: [Function] Timer

24 May 2014, 00:40

Added an "Elapse" option and the ability to create a timer with a period of zero.

Inspired by tidbit in his script below that also shows nifty use of saving A_TickCount information to an array.

http://ahkscript.org/boards/viewtopic.php?f=6&t=537

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
FanaticGuru
Posts: 776
Joined: 30 Sep 2013, 22:25

Re: [Function] Timer

24 May 2014, 01:15

Added an "Unset" option which removes a timer from the Timer array.

Having a no longer needed timer continue to exist has very little impact but if for some reason you are creating massive amounts of timers that you will not continue to need then it might be necessary to delete them.

Also it allows you to keep the Timer array uncluttered so that you can then loop through the array and not have to deal with no longer needed timers.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
TygerByte
Posts: 49
Joined: 12 Aug 2016, 05:22

Re: [Function] Timer

23 Sep 2016, 20:17

Hi thought I'd contribute some examples of my usage here. Thanks FanaticGuru for this great library.

Arwen2.0 script I write and named after my buddy Arwen. I believe it was set to 800x600 in a VM setup. It would do pixelsearch on the target's HP or MP then cast spells.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Another Script I wrote for Skill Rotation. I'd like to also thank MasterFocus for his WaitPixelColor Function which you can find @https://github.com/MasterFocus/AutoHotkey which I used for the function TabForPixelColor

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Ulfric Stormcloak
Posts: 39
Joined: 28 Apr 2017, 23:26

Re: [Function] Timer

25 May 2017, 13:27

FanaticGuru wrote:[Function] Timer

Below is a function I use often in my gaming scripts to keep track of timers. Generally the cooldown on abilities which is prevalent in many games.

The function is easy to use and not as complicated as the comments at the beginning might imply.

Code: [Select all] [Expand] [Download] (Timer.ahk)GeSHi © Codebox Plus



A practical gaming example.

Code: [Select all] [Expand] [Download] (Timer_Example.ahk)GeSHi © Codebox Plus


You have 5 abilities called Bash, Thrash, Trash, Slash, Crash with different cooldowns that are activated by the keys 1 2 3 4 5.
Push or hold down F1 to use any ability that is off cooldown.

The Timer function has a lot of versatility that is explained in the comments of the function.

FG


I am using your script it works really well. I dont understand anything in the timer.ahk file but i use it anyways.

I just have a few questions
Is their a way to add a function that holds down left mouse button when the script isnt pressing any buttons ? Like during gap in the timer.
Also i was instead of having to hold the F1 key or some other key. Is their a way to make this toggle-able.

This is the code i am using

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

FanaticGuru
Posts: 776
Joined: 30 Sep 2013, 22:25

Re: [Function] Timer

29 May 2017, 17:46

Ulfric Stormcloak wrote:Is their a way to add a function that holds down left mouse button when the script isnt pressing any buttons ? Like during gap in the timer.
Also i was instead of having to hold the F1 key or some other key. Is their a way to make this toggle-able.


This will cause z to toggle the key pressing off and on.

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Pressing left mouse in the gap in the timers is vague to me. If you basically want the left mouse held down all the time except the instant that a key is pressed you can do: Send {LButton Up}4{LButton Down}. You will also need to send a LButton down when the code is toggled on and then a LButton up when the code is toggled off but that is the basic concept.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 10 guests