Spaces & Quotes in Commands
Posted: Mon Sep 08, 2008 10:55 pm
You may have noticed that in order to use spaces in Half-Life commands and scripting, you require quotes around them. This can be troublesome in the case that multiple quotes are needed because HL does not recognize quotes-within-quotes. Fortunately, with the release of HLDJ v1.2.6 this problem can be circumvented by using the "*' character instead of spaces. Here's an example:
Normally, you might use the following commands to select an audio file name containing spaces:
To make life easier, you may want to bind this to a key or alias:
However, this will not work because HL will not recognize the inner pair of quotes within the outer pair. The solution is to eliminate having to use quotes by replacing the spaces in the file name with the "*" character instead:
This can help out tremendously when making script files that automatically bind keys to your favourite audio files.
Normally, you might use the following commands to select an audio file name containing spaces:
Code: Select all
bind:"my file name";hldjsf
Code: Select all
bind k "bind:"my file name"; hldjsf"
Code: Select all
bind k "bind:my*file*name; hldjsf"