SCAR is the scripting language for Dawn of War, standing for Scripting at Relic.
It is used mainly in the single player missions, but comes 3 file forms:
Each one uses SCAR functions.
SCAR uses the LUA scripting language, which is mearly a basis for what they have changed it to. Several LUA things would make no sense in Dawn of War (such as GUI related functions).
Note that all SCAR files are compiled at run time, and this makes debugging harder (as you have to run the code until it fails and gives a FATAL SCAR ERROR and stops the program – see Debugging.
One way to edit SCAR's plain text files is to use Textpad, and use a syntax file to highlight the code. To do this, firstly download the syntax file: here (you may need to Save Target As to download).
Then, place it in your samples directory, which for the latest version 4, is: C:\Program Files\TextPad 4\Samples
Then, once you open textpad, go to the menu Configure -> New Document Class. You can put any name, but DOW SCAR will probably to. Class members are: *.nis, *.scar, *.ai. Note: the AI files use a lot of custom functions, and so not as useful for that.
For the next page, you must Enable Syntax Highlighting, and choose the scar.syn file from the dropdown box – if you have put it in the right place, that is! Then click Finish.
This document class will appear in the Preferences menu. It is recommended to turn on Strip Trailing spaces from lines when saving, just to save some extra space, which would otherwise be wasted unnessissary extra whitespace. You can also modify the colours here, and selecting a different colour (eg: dark red) for Keywords 2, makes some things better distinguished.
Tutorials, advice, and examples of SCAR.
These beginner tutorials should be done in step by step, and allows you to build up knowledge of how SCAR works (wether you have coded before or not). It will start with very general things, and build up to the singleplayer SCAR files.
SCAR is a very easy language to use, because Dawn of War doesn't do very many complicated things (the entire scenario is contained within one file!).
Once you have completed the tutorials, you should be able to make singleplayer SCAR files very easily.
These are done by FinalDeath:, and uses expamples from Dawn of War's singleplayer campaign, and some new scripts.
You can look at these SCAR examples, templates and advanced tutorials for more information.
This section is dedicated to a Primer of these sections of SCAR:
Also see the LUA site documentation for more basics like this.
The functions in SCAR, while avalible at ScarDoc, are not editable (and not updated for later patches), and do not include other notes.
Once complete, the Functions section will contain all avalible game functions to use in SCAR scripts, as well as appropriate examples, notes, revisions and updates. Each function will have its own sub-page. The functions page will link to the index and category pages where you can find list of the SCAR functions.
This section explains the world of Cutscenes and Non Interactive Sequences.
Advanced NIS section, for a fuller set of examples and more advanced work.
This is some information on Artificial Intelligence SCAR scripting in Dawn of War.