Quotes within quotes in scripts?

Status
Not open for further replies.
Hi there. I've been wanting to make a script that would allow me to make my character face in the opposite direction and change the controls accordingly. I don't really have any issue with using the down arrowkey instead of the up arrowkey and vice versa when the player character is facing backwards, but just for the hell of it, I wanted to make it so I didn't have to do that. In order to do this, I added the following into my autoexec.cfg file:

bind j "cam_rotate 180; setcontrol forward "DOWN ARROW"; setcontrol bacward "UP ARROW";"
bind k "cam_rotate 0; setcontrol forward "UP ARROW"; setcontrol backward "DOWN ARROW";"

At first I was like, whoo!
But then I was all, wait a minute here.

Computers are stupid; hence, mine doesn't know that when I introduce another double-quote in the course of the code, I mean to open another string, not close the one that I have open already. How do I get around this? Again, it's not like I really need to; I'm just really curious.
 
Last edited:
You can only have one set of quotes per line, but you can set aliases to get around this. For instance:

alias line1 say "This is part of the macro"
alias line2 say "So is this."
bind k "line1; line2;"
 
It should probably register escaping quotes "Like this to do \"DOWN ARROW\"" but it wouldn't surprise me if this doesn't exist. Might register that through as a bug actually.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top