About this mod
Two tools, "key_presser" and "key_toggler" for Baldur's Gate 3 to highlight certain items in game without need to keep holding the key.
Inspired by "Alt toggle for Baldur's Gate 3" from sokolb with the option to select the key via configuration file.
- Requirements
- Permissions and credits
- Changelogs
Baldur's Gate 3 has the option to highlight items by pressing a key. The impractical thing is that you have to hold the button to show the higlights without an option to toggle it on or off.
Two tools to keep your "Highlight Items" button pressed while playing Baldur's Gate 3. Though there is no optimal and clean solution, one of these tools could possibly fit your needs.
TL;DR
Description
Select a tool that fits your needs:
- key_presser holds a key for 3 seconds, then releases it and presses it again. Useful when you e.g. open the inventory with Tab and want to keep items highlighted after closing the inventory.
- key_toggler just presses a key. But if you e.g. open your inventory with Tab, the highlights will disappear so you have to toggle key_toggler again after closing the inventory.
Installation
KeyHandler_v1.0.0.zip
- Just copy the tool of your choice (key_presser or key_toggler) into a folder of your choice and start it.
KeyHandler_v1.0.0.ahk.zip
- Install AutoHotkey.
- Run your preferred script from the scripts directory or compile it to an executable.
KeyHandler_v1.0.0.zip
You will be asked for a key on the first run. This will create a configuration file automatically which is read on next startups.
KeyHandler_v1.0.0.ahk.zip
See READMEs inside the archive.
Details
Installation
- Select the tool you want (either key_presser or key_toggler). See description below.
- Just copy the .exe-file(s) from the ZIP archive you want to use into a folder you like.
- If you want to use another key than BG3's default "Alt" key for toggling item highlighing, copy according .cfg file, too.
- After being started the according tool runs in the background while a tray icon with the key status is shown. Tray icons: 🔎 if key handling is disabled, ⭐ if handling for a key is activated.
- A configuration file with the same name as the tool but with .cfg extension will be created in the same directory next to the executable if you select a key and confirm it.
key_presser
Keeps a key pressed as long as the key toggle is activated. Intended to be used for BG3's "Highlight Items". It even keeps highlighting active when you switch between screens (with some small delays).
Configuration
On first startup of this tool, a file key_presser.cfg will be generated after you have selected a key in the GUI and confirmed it.
- controlKey : Mandatory: Intended for the "Highlight Items" key to be kept pressed. On first start you will be asked for a key.
- keyPressTimerTimeout: Optional: Time in milliseconds the key keeps being pressed. Default: 3000
- keyPressReleaseDelay: Optional: Time in milliseconds between key release and key press (again). Values too low lead to key presses not being recognized. Default: 30
Known issues
Flickering of highlights
That is because this tool simulates a key press for a time of keyPressTimerTimeout milliseconds (3000ms = 3s per default) and releases the key for keyPressReleaseDelay milliseconds (30ms per default).
This is because of BG3's key handling. Try it out: If you have your "Highlight Items" key mapped to e.g. F9, hold F9 while you press Tab. You will see that the highlights disappear (and keep disappeared) while the inventory opens and you still press the key. You must release the key and press it again to make highlighting work again.
Between key press and key release has to be a little timeout that though is long enough to recognize it. Otherwise key actions are not recognized.
But with keyPressTimerTimeout and keyPressReleaseDelay you can configure the key press and release delays so the flickers are in your hands in some way. ;)
If flickering of highlighted items and their messages is some kind of OCD thing to you, use key_toggler. But keep in mind that you have to reactivate the highlight toggle after some actions when using key_toggler.
key_toggler
Just switches configured key between pressed and released.
This tool is closer to sokolb's Alt toggle for Baldur's Gate 3 tool.
- Run key_toggler.exe.
- On first run you will be asked for a key you want to toggle.
- If you press the OK button, a configuration file with the same name but .cfg extension will be created and loaded next time on startup.
Known issues
Problem there is that if you, for example, press Tab to show the inventory, the highlights disappear. This seems to be a problem with BG3 itself as it looses the highlights though you keep pressing the "highlight items" button.
So if the highlighting disappears after you have opened your inventory with Tab or quicksaved your game, you have to reactivate the toggle.
Notes
- Made primarily for Baldur's Gate 3 to keep on highlighting items. But as it does not lock to a window it could be used for other things, too.
- Better to assign an alternate key (I used an F-Key) for that, though both tools work with `Alt`. But you will not be able to `[Alt-Tab]` to another window if you use the `Alt` key.
- You do not need the `scripts/*.ahk` scripts. It's just if you want to modify and/or create new executables from them.
- You can rename any tool and run separately (if names differ). The configuration files are based on the base name of the tool. A tooltip showing when you hover your mouse over the tray icon reveals the name and status of the running tool.
- Tray icons: 🔎 if key handling is disabled, ⭐ if handling for a key is activated.
- AutoHotkey v2 scripts and compiled .exe.
- Microsoft Defender eventually warns about the .exe being a Trojan:Win32/Bearfoos.A!ml. This is likely a false-positive and can be ignored.
- Based on Alt toggle for Baldur's Gate 3. Thx to sokolb for inspiration.
References
- https://www.nexusmods.com/baldursgate3/mods/787
- https://www.reddit.com/r/AutoHotkey/comments/13y9zih/keystroke_toggle_script/
- https://www.autohotkey.com/docs/v2/lib/
- https://www.flaticon.com/free-icon/emergency-button_5983097
- https://www.flaticon.com/free-icon/press-button_10994913
- https://icon-icons.com/icon/gesture-press/102855
- https://icon-icons.com/icon/toggle/231640
- https://icon-icons.com/