How to bind songs to keys
Posted: Sat Feb 07, 2009 3:43 am
Although one of the best features of HLDJ is using the console interface, some times this can get tedious, especially if the moment is ripe for a particular song, so here's the definitive tutorial on how to bind a key to a song for quick access.
1) creating binds:
Some people simply bind keys to song numbers. Sure, it's simple & easy in the short-term, but if the numbers should ever change (i.e. if you add/remove songs) it can be problematic. The recommended method is to use the absolute binding technique as explained in HLDJ's in-game help message #3 (enter 'hldj3' in console). This method is briefly outlined below:where:
<key> is the desired bind key
<command relay key> is the one set in HLDJ's advanced setup (default is '=')
> tells HLDJ to load the file/folder exactly - no search is performed. (optional, but more effecient)
$ tells HLDJ that the path provided is relative to your audio folder. (optional, but saves you typing)
* must be used instead of spaces in the path due to limitations in HL's bind syntax
; is a separator between commands
hldjsf tells HLDJ that the path points to a file (use hldjsd for a directory)
Here are some examples:Much more details on the advanced binds can be found in the in-game help.
2) using them in a script
Once you've got the hang of the above technique, create your binds and place them in a config file, possibly your hldj_custom.cfg or the game's autoexec/userconfig, so that they are loaded on start-up.
So is that all there is to it? Yes - if you don't mind using your keys for audio binds, but many players use nearly all their keys for the game, which is where dynamic binding comes into play...
3) dynamically binding your keys
To make the best use of your keys, you can rebind the same keys to different actions dynamically, like so:
Create a config file, i.e. "my_hldj_binds.cfg", and place all of your audio binds into this file.
In another config file, i.e. "my_default_binds.cfg", place all of your original game binds (alternatively you can also just use your game's config.cfg).
You'll want to place the first file in your custom folder so that it is copied to the game directory on start-up. Also, if the keys you use have different meanings in different games, you'll want create and place a default bind config in each game's config folder (or as mentioned above, just use the game's config.cfg).
Next, bind a key to "exec my_hldj_binds.cfg" and one to "exec my_default_binds.cfg".
Now you can use these keys to switch between your audio binds and game binds easily!
You can leave it at that, or if you've got the hang of scripting you can really start to get creative. For example, you can use a single key to toggle between your binds, or use the +/- aliases to load the configs on key-down/key-up presses:Just bind a key to "mybinds" (again, you can place this code into your custom config) and hold it down to activate your audio binds, and release to deactivate them.
so 128 keys aren't enough?...
If you still need more binds keys (!?), you can create multiple config files (as above) to map more keys to songs.
The ultimate solution (overkill) is to have key mappings for your key mappings. For example, you could create a config, i.e. "my_keymappings.cfg" that binds a set of keys to exec your various other configs:After binding a key to exec this file, it will rebind the above keys to exec another config that will re-map your keys to audio binds (again, you can alter it so that it's done on key-down/up presses).
This technique ultimately allows you to bind an infinite amount of keys, but of course this is the extreme case and who would actually want to remember so many binds?? [/size]
1) creating binds:
Some people simply bind keys to song numbers. Sure, it's simple & easy in the short-term, but if the numbers should ever change (i.e. if you add/remove songs) it can be problematic. The recommended method is to use the absolute binding technique as explained in HLDJ's in-game help message #3 (enter 'hldj3' in console). This method is briefly outlined below:
Code: Select all
bind <key> "bind <command relay key> >$\<relative*path*to*file>; hldjsf"
<key> is the desired bind key
<command relay key> is the one set in HLDJ's advanced setup (default is '=')
> tells HLDJ to load the file/folder exactly - no search is performed. (optional, but more effecient)
$ tells HLDJ that the path provided is relative to your audio folder. (optional, but saves you typing)
* must be used instead of spaces in the path due to limitations in HL's bind syntax
; is a separator between commands
hldjsf tells HLDJ that the path points to a file (use hldjsd for a directory)
Here are some examples:
Code: Select all
bind x "bind = >$\voices\simpsons\homer.wav; hldjsf"
bind y "bind = >$\voices\simpsons\homer; hldjsf" // note the ".wav" is optional
bind a "bind = >$\music\some*album\track1.wav; hldjsf" // note the space is replaced by *
bind b "bind = >$\music\some*album\; hldjsd"
// binds a directory. note the '\' at the end and 'hldjsd'
2) using them in a script
Once you've got the hang of the above technique, create your binds and place them in a config file, possibly your hldj_custom.cfg or the game's autoexec/userconfig, so that they are loaded on start-up.
So is that all there is to it? Yes - if you don't mind using your keys for audio binds, but many players use nearly all their keys for the game, which is where dynamic binding comes into play...
3) dynamically binding your keys
To make the best use of your keys, you can rebind the same keys to different actions dynamically, like so:
Create a config file, i.e. "my_hldj_binds.cfg", and place all of your audio binds into this file.
In another config file, i.e. "my_default_binds.cfg", place all of your original game binds (alternatively you can also just use your game's config.cfg).
You'll want to place the first file in your custom folder so that it is copied to the game directory on start-up. Also, if the keys you use have different meanings in different games, you'll want create and place a default bind config in each game's config folder (or as mentioned above, just use the game's config.cfg).
Next, bind a key to "exec my_hldj_binds.cfg" and one to "exec my_default_binds.cfg".
Now you can use these keys to switch between your audio binds and game binds easily!
You can leave it at that, or if you've got the hang of scripting you can really start to get creative. For example, you can use a single key to toggle between your binds, or use the +/- aliases to load the configs on key-down/key-up presses:
Code: Select all
alias +mybinds "exec my_hldj_binds.cfg" // executes songs binds when you press & hold
alias -mybinds "exec my_default_binds.cfg" // executes default binds on release
so 128 keys aren't enough?...
If you still need more binds keys (!?), you can create multiple config files (as above) to map more keys to songs.
The ultimate solution (overkill) is to have key mappings for your key mappings. For example, you could create a config, i.e. "my_keymappings.cfg" that binds a set of keys to exec your various other configs:
Code: Select all
bind 1 "exec my_hldj_binds1.cfg"
bind 2 "exec my_hldj_binds2.cfg"
//...
bind N "exec my_hldj_bindsN.cfg"
This technique ultimately allows you to bind an infinite amount of keys, but of course this is the extreme case and who would actually want to remember so many binds?? [/size]