Highlighting and Compiling QCs with ConTEXT

From Valve Developer Community
Jump to navigation Jump to search
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
Broom icon.png
This article or section should be converted to third person to conform to wiki standards.

What you need

Note.pngNote: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.

Context2.jpg

Type in the QC file ending (no period)

Context3.jpg

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.pngNote: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.pngNote: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.pngNote: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.

Context4.jpg

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.

QCHighlighted.png

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