Bind key to play specific sound and then stop?

Help with using HLDJ
Post Reply
Lucky
Game DJ
Posts: 1
Joined: Tue Apr 12, 2011 8:28 am

Bind key to play specific sound and then stop?

Post by Lucky »

I used to do it along time ago but haven't used hldj in along time, was wondering if anyone here knew how I could set certain buttons like Kp_home to select a certain sound play it for a certain amount of time and then stop audio? so for instance my sound file do a barrel roll, if I pushed the number 7 on my keypad it would play "Do a barrel roll" and then stop audio. How would I bind that in auto exec?
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: Bind key to play specific sound and then stop?

Post by Renegade »

check this thread for the best way to bind audio files to keys: http://hldj.org/forums/viewtopic.php?f=6&t=252

How to make them stop after a certain time though is tricky, especially depending on the game. Generally you will need to use a "wait" command, but the syntax and effect varies by game. Old HL games use combinations of "wait" which equates to 1 tick (about 1ms). Some older source games use the same syntax. Newer Source games use the "wait X" syntax, where X is the number of ticks to wait, but results may vary.

Also depending on whether the game allows input while you are "wait"ing, you may find you are unable to move/play while waiting for the song to stop. For short audio though, this might be negligible.
Post Reply