Page 1 of 1
Bind key to play specific sound and then stop?
Posted: Tue Apr 12, 2011 8:31 am
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?
Re: Bind key to play specific sound and then stop?
Posted: Tue Apr 12, 2011 7:21 pm
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.