How to bind songs to keys

Cool tips, tricks, FAQs, scripts, binds, etc.
Post Reply
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

How to bind songs to keys

Post by Renegade »

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:

Code: Select all

bind <key> "bind <command relay key> >$\<relative*path*to*file>; hldjsf"
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:

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'
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:

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
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:

Code: Select all

bind 1 "exec my_hldj_binds1.cfg"
bind 2 "exec my_hldj_binds2.cfg"
//...
bind N "exec my_hldj_bindsN.cfg"
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?? :lol: [/size]
Leafblower29
Game DJ
Posts: 3
Joined: Fri Jan 22, 2010 7:15 pm

Re: How to bind songs to keys

Post by Leafblower29 »

WOw thx i came t othe forum just for this thread :D
ivrytwr3
Game DJ
Posts: 1
Joined: Mon Mar 15, 2010 9:57 am

Re: How to bind songs to keys

Post by ivrytwr3 »

OK, i need a bit of help here. HLDJ works in game for me for indivual binds, but i would like to set up different keys to different binds, but it ain't working. This is what i am trying, whaere have i gone wrong?!

bind UPARROW "bind MOUSE4 >C:\Users\The xxxxx Family\Desktop\games\hldj\hldj_1.5.02b\HLDJ\@Stanlio&Ollio.wav; hldjsf"

(mouse4 works with sample audio and my audio files ingame).
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: How to bind songs to keys

Post by Renegade »

You forgot to replace spaces (" ") in the file path with "*". It should look like:

Code: Select all

bind UPARROW "bind MOUSE4 >C:\Users\The*xxxxx*Family\Desktop\games\hldj\hldj_1.5.02b\HLDJ\@Stanlio&Ollio.wav; hldjsf"
It's a common mistake, but you'll notice it right away if the game complains about your syntax (the game engine cannot handle spaces in command arguments)

Another tip is that you should try to specify the path relative to your audio directory. For exmaple, if your Audio Directory were "C:\Users\The*xxxxx*Family\Desktop\games\hldj\hldj_1.5.02b\HLDJ", then the better bind would be:

Code: Select all

bind UPARROW "bind MOUSE4 >$\@Stanlio&Ollio.wav; hldjsf"
Itachi
Game DJ
Posts: 3
Joined: Thu Jun 17, 2010 4:11 am

Re: How to bind songs to keys

Post by Itachi »

Renegade wrote:For exmaple, if your Audio Directory were "C:\Users\The*xxxxx*Family\Desktop\games\hldj\hldj_1.5.02b\HLDJ", then the better bind would be:

Code: Select all

bind UPARROW "bind MOUSE4 >$\@Stanlio&Ollio.wav; hldjsf"
Do you mean the audio directory is "C:\Users\The*xxxxx*Family\Desktop\games\hldj\hldj_1.5.02b\HLDJ\Audio"? I am having trouble getting my binds to work and I think the problem may be simply location. That Audio folder is there by default right? In the ">$\" binds, I have tried using them both with and without "\Audio" to no avail.
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: How to bind songs to keys

Post by Renegade »

'$' points to whatever Audio Directory has been set for the game. For example, if your audio directory is "C:\HLDJ\Audio" and you want to load "My Audio.wav", you would use ">$\My*Audio.wav" (not ">$\Audio\My*Audio.wav"). For backwards compatibility, it should work with and without the backslash after '$', but it's always better to include it.
Mannosuke
Game DJ
Posts: 2
Joined: Sun Sep 19, 2010 7:54 pm

Re: How to bind songs to keys

Post by Mannosuke »

I can't seem to get mine to work. F1 is my broadcast key, and I'm trying to set up F3 to be bound to a certain song. I entered:

bind F3 "bind = >G:\TF2*Micspam\ahaha.wav; hldjsf"

And upon pressing F3, I receive this message in console:

bind <key> [command] : attach a command to a key
Host_WriteConfiguration: Wrote cfg/hldj_cmd_c.cfg

F1 continues to be bound to the previous song I selected normally with no change. Each time I press F3 it doesn't do anything but write a new config file. Could you help me out?
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: How to bind songs to keys

Post by Renegade »

It has been noticed that the ":" character causes problems for certain games. The next release will fix this by allowing the use of "|" in place of ":"; until then, use a path that avoids this char, i.e. use "$" to load from the audio dir, or "\" to load from the root dir.
Mannosuke
Game DJ
Posts: 2
Joined: Sun Sep 19, 2010 7:54 pm

Re: How to bind songs to keys

Post by Mannosuke »

Yep, that fixed it. Thanks a lot.
Paralyze
Game DJ
Posts: 2
Joined: Wed Sep 29, 2010 2:56 pm

Re: How to bind songs to keys

Post by Paralyze »

I'm having trouble using the dramatic method of binding keys to open
a cfg file. I'm using one of my cfg files in the hldj custom folder and
the other is the autoexec from the game. Do the cfg files have to be
in the same folder or in differen't places? I'm really confused, need
some help here.

I use these commands as written is there any problems here?
because i've tried to put the binds in the cfg files but in game
they wont execute.

bind + "exec hldj_custom.cfg"
bind - "exec autoexec.cfg"
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: How to bind songs to keys

Post by Renegade »

You probably want to exec config.cfg not autoexec.cfg.
Secondly, you'll want to place your audio binds in a separate file other than hldj_custom.cfg, Follow the guidelines in #3.
Paralyze
Game DJ
Posts: 2
Joined: Wed Sep 29, 2010 2:56 pm

Re: How to bind songs to keys

Post by Paralyze »

Thanks, had to use another cfg file other than custom.
Post Reply