Search code examples
scriptingconsoleescapingsource-engine

Escaping double quotes in TF2 scripting


In TF2 scripting, there is a simple command, echo. This simply logs a message to the console. It can be used with or without double quotes. However, I want to be able to log something to the console involving double quotes--say, the string He said, "nope.". In conventional programming, one would escape the quotes, as so:

echo "He said, \"nope.\""

However, in the TF2 console, this writes:

He said, \ nope.\ 

Is there a way to use quotes in echo and related commands? (E.g. say)


Solution

  • It's not possible to output double quotes using echo or say, only single quotes. (source) (In fact whenever you type double quotes into regular chat they're automatically changed into single quotes. I don't know why this limitation exists, I'd have to dig around.)