Upvote Upvoted 1 Downvote Downvoted
(Scripting) Binding a key with nested quotes
posted in Q/A Help
1
#1
0 Frags +

This is a really quick question and i'm wondering if anyone knows the answer here. How do you bind a key to a command that would require quotes in it? Example:

spec_player "Hot Dog"

to bind this you'd need to do

bind "i" "spec_player "Hot Dog""

but the game sees the quotes as ending the first set rather than opening a new set... is there any way around this in the scripting syntax?

This is a really quick question and i'm wondering if anyone knows the answer here. How do you bind a key to a command that would require quotes in it? Example:
[code]spec_player "Hot Dog"[/code]
to bind this you'd need to do
[code]bind "i" "spec_player "Hot Dog""[/code]
but the game sees the quotes as ending the first set rather than opening a new set... is there any way around this in the scripting syntax?
2
#2
4 Frags +

Basically, the command has to be on its own line because of the way quotes work. So essentially it has to be in its own file, and then you exec the file.

Basically, the command has to be on its own line because of the way quotes work. So essentially it has to be in its own file, and then you exec the file.
3
#3
0 Frags +

I thought you could use aliases for this?

I thought you could use aliases for this?
4
#4
2 Frags +

no an alias is the same issue.

alias hot_dog "spec_player "Hot Dog""

still nested quotes. the correct answer is Andkenneth's: make a seperate .cfg file named hot_dog (in this example) with the command

spec_player "Hot Dog"

and then make a bind to exec it ie

bind i "exec hot_dog"
no an alias is the same issue.

[code]alias hot_dog "spec_player "Hot Dog""[/code]

still nested quotes. the correct answer is Andkenneth's: make a seperate .cfg file named hot_dog (in this example) with the command

[code]spec_player "Hot Dog"[/code]

and then make a bind to exec it ie

[code]bind i "exec hot_dog"[/code]
5
#5
0 Frags +

thanks guys for answering this

thanks guys for answering this
Please sign in through STEAM to post a comment.