Page 1 of 1

Buff timer - autohotkey script

Posted: Sat May 13, 2017 12:59 pm
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.

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 1:11 pm
by Akroma666
Still isn't overlaying the timer in the actual game exe.

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 1:16 pm
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.

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 1:35 pm
by Akroma666
Both did not work

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 1:45 pm
by Mork
Are you sure game runs borderless? Except creating autocmds.txt you also need to set it to windowed in game settings.

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 9:28 pm
by Akroma666
Question, can you change the countdown timer to flash red with the last 10 seconds?

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 9:36 pm
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.

Re: Buff timer - autohotkey script

Posted: Sat May 13, 2017 10:33 pm
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