3

Is it possible to put quotes inside quotes in the Source developer console? For instance, is it possible to bind

bind KP_END "give weapon_357"

to KP_INS?

bind KP_INS "bind KP_END "give weapon_357""

returns a syntax error.

0

3 Answers 3

5

You cannot nest quotes in console commands. I'm not sure if there is a way to escape them, but you can work around this limitation by aliasing the quoted command. For example, in your case:

alias givewpn "give weapon_357"

Then do:

bind KP_INS "bind KP_END givewpn"

And voilà, the second command doesn't require quotes anymore.

2
  • Thanks! All I needed to know was whether it's possible (I edited my question for clarity now), as my aspect is to read the commands, not to write them. I had to write a parser for retrieving information from a CFG, and I wanted to know if the parser would ever need to parse quotes inside quotes. Therefore it would be nice if someone could confirm that it is not possible.
    – osvein
    Commented Jan 10, 2014 at 19:18
  • 1
    @anustart Well, I don't know about other escape methods but I'm reasonably certain that you can't put quotes in quotes because the console just seems to take everything from the starting quote to the next one (or the end of the line) as a token. For example, "bind""f11""toggleconsole is a valid bind command.
    – a cat
    Commented Jan 10, 2014 at 20:12
2

There is no way to escape double-quotes, but you can create a CFG (valve wiki) file, for example, cfgFileName1.cfg in gameFolder\cfg with contents bind KP_END "give weapon_357"

and now bind KP_INS "exec cfgFileName1"

for better organizing use alias command (use unique aliases!)

-1

Just bind straight to KP_INS. That should work. There is no point have a bind within a bind. I not to sure on the situation but by the looks of it what I said should work.

Just do:

bind KP_INS "give weapon_357"

I know from csgo and soruce that all you have to do is that and it'll work. Even if there was a previous bind on that key it should replace it with the new bind.

1
  • 3
    This doesn't answer the question. There is a point to a bind within a bind; you can set keys to rebind profiles, so that pressing, say, F2 gives you bindings for testing a map while F3 disables them.
    – Schism
    Commented Jan 10, 2014 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .