Buff timer - autohotkey script

Helpful Hints for Both the Technical and Roleplaying Aspects of the Game

Moderators: Moderator, DM

Post Reply
User avatar
Mork
Posts: 379
Joined: Sun Mar 26, 2017 1:51 pm

Buff timer - autohotkey script

Unread post by Mork »

So I've decided to post separate topic since it might help more people:

How to get small window with countdown timer for your buffs/rage/etc

1: Install Autohotkey (google it)
2: Create text file then change its extension to ".ahk" like "timer.ahk"
3: Edit this code and put it inside a file using notepad: https://pastebin.com/fKLGMPXB

You will need to edit:

Code: Select all

$8:: ;hotkey to activate buff
Send, {8 down}
Sleep 10
Send, {8 up}
So for example if you need rage timer and use hotkey of "2" for it change code to:

Code: Select all

$2:: ;hotkey to activate buff
Send, {2 down}
Sleep 10
Send, {2 up}
For time amount edit:

Code: Select all

timerCount := 10 ; Change me
To change timer position:

Code: Select all

WinMove, 200, 5 ; Change these values to move the window
Also to make it work you need to play NwN2 borderless. For that set display to windowed in NwN options then use extended client and create autocmds.txt file in your Documents/NwN2 folder with this code inside:

Code: Select all

/fswindow
/mpredict

You can now run program as an ahk script or compile it to exe (save file, right click and select "Compile Script")

Always run it before running NwN2. You can also create bat file to make 1 shortcut run 2 programs at the same time. Here is how to do it: http://www.makeuseof.com/tag/launch-mul ... atch-file/

When you exit NwN2 timer window will still be visible on screen - to close it simply press "\"

Also you can change that hotkey editing line:

Code: Select all

\::
ExitApp
For now it supports one simple timer but if more is needed I can tinker around a bit and perhaps add new functions.
Last edited by Mork on Sat May 13, 2017 1:24 pm, edited 4 times in total.
User avatar
Akroma666
Posts: 1888
Joined: Mon Jan 16, 2012 2:24 pm
Location: California

Re: Buff timer - autohotkey script

Unread post by Akroma666 »

Still isn't overlaying the timer in the actual game exe.
Storm - The Blade Flurry
Druegar Grizzleclaw - The Mountain Ruin Tsar
Akroma Thuul - The Creepy Enchanter
Liliana Duskblade - The B*tch of Bane
Jamie Dawnbringer - The Light in the Darkness
User avatar
Mork
Posts: 379
Joined: Sun Mar 26, 2017 1:51 pm

Re: Buff timer - autohotkey script

Unread post by Mork »

Hmm it seems to work diffrently on diffrent systems.
Try with: https://pastebin.com/MzJcQ8qw
(just added below line)

Code: Select all

	Winset, AlwaysOnTop, on
Or with this code:
https://pastebin.com/fKLGMPXB

To make timer window clickable-through.
User avatar
Akroma666
Posts: 1888
Joined: Mon Jan 16, 2012 2:24 pm
Location: California

Re: Buff timer - autohotkey script

Unread post by Akroma666 »

Both did not work
Storm - The Blade Flurry
Druegar Grizzleclaw - The Mountain Ruin Tsar
Akroma Thuul - The Creepy Enchanter
Liliana Duskblade - The B*tch of Bane
Jamie Dawnbringer - The Light in the Darkness
User avatar
Mork
Posts: 379
Joined: Sun Mar 26, 2017 1:51 pm

Re: Buff timer - autohotkey script

Unread post by Mork »

Are you sure game runs borderless? Except creating autocmds.txt you also need to set it to windowed in game settings.
User avatar
Akroma666
Posts: 1888
Joined: Mon Jan 16, 2012 2:24 pm
Location: California

Re: Buff timer - autohotkey script

Unread post by Akroma666 »

Question, can you change the countdown timer to flash red with the last 10 seconds?
Storm - The Blade Flurry
Druegar Grizzleclaw - The Mountain Ruin Tsar
Akroma Thuul - The Creepy Enchanter
Liliana Duskblade - The B*tch of Bane
Jamie Dawnbringer - The Light in the Darkness
User avatar
Mork
Posts: 379
Joined: Sun Mar 26, 2017 1:51 pm

Re: Buff timer - autohotkey script

Unread post by Mork »

Fairly easy - I'll check tomorrow how it can be done.

I'm also thinking about creating a module that would read log file for casting spells. That way so similar to timer message would appear informing that something is casting a certain spell - just to help classes with spellcraft recognize spells even when there is a ton of dmg messages from attacks calculation in log.
User avatar
Aspect of Sorrow
Custom Content
Posts: 2679
Joined: Fri Mar 28, 2014 7:11 pm
Location: Reliquary

Re: Buff timer - autohotkey script

Unread post by Aspect of Sorrow »

The tool I wrote reads the ID of the spell / feat sent over the network and determines the time from the 2DA. Was going to make it line up two rows of spell icons and write the timer text on top of them.

Image
Post Reply

Return to “Tips & Tricks”