Highlighting and Compiling QCs with ConTEXT

From Valve Developer Community
Jump to: navigation, search

What you need

Note.png Note: The QC highlighter is still in development. If you find anything wrong or have suggestion, contact Wolf.

How and what

ConTEXT is a beefed up notepad useful to programmers. One of the handy things it has built-in is a batch system that can be set up to compile files depending on their endings. I told ConTEXT that whenever i have a .qc file open and press F9, it should execute studiomdl.exe and the path to the qc file. This compiles the model for you while you are in the editor, and it saves the hassle of keeping a shortcut of studiomdl around. I also prefer it over custom compile tools because of its simplicity, and after writing 50+ qc's I got used to the whole qc format, so I don't really need a tool to make a qc for me. Another advantage with ConTEXT is it's ability to color code functions and values, witch makes it a lot easier to read the file.

How to set it up

First install ConText, then after that is done, open it and go to the Options->Environment Options on the menu bar. Context1.jpg

At the top, go to the Execute Keys tab and press Add on the left side.


Type in the QC file ending (no period)


Select one of the 4 F# functions, I use F9. You can basically have 4 different batches done on one format.

Execute: This is the path to your studiomdl.exe.

Note.png Note: If you don't know where it is, type "%sourcesdk%\bin\" in the address bar of Windows Explorer (not Internet Explorer, a folder like my computer, the run option in Windows is also usable).

Parameters: The other important one, this gives the path of the .qc file. Use %n.

Note.png Note: At the bottom of the menu there is a description of what %n and other special parameters do.

Capture Console: This just echoes the output of studiomdl at the bottom of context instead of a cmd or dos window, handy for spotting errors.

Note.png Note: Alternatively you can also have "Pause after execution" instead, that way you will still be able to see the color coding of the errors and warnings.


Next download the qc highlighter and put it in the highlighter folder where you installed ConText. Now ConText will color the functions, values and operators in the QC. This helps a lot when bug fixing and trying to understanding the QC format.


Thats pretty much it, now all you do is open any QC file and press F9, and it will compile it for you, easy stuff.

See also