The
  Way Of
    The Wombat
Introduction

Contents

1.0 Intro
1.1 Stuff
1.0 Intro

SLIC is a scripting language for CtP2.
This means basically that it is a simplified programming language designed for use in CtP2. This allows you to make subtle, or not-so-subtle changes to the way the game plays, how some of the game rules act, and other such interesting things. It is based on a C-like syntax, but I see it very differently from C, because primarily it is events-driven language. In essence, think of SLIC as a reaction-language ie When x happens, SLIC makes y happen - and the key to it being finding out precisely which x and which y you want. This makes it very useful for making events occur in scenarios, as demonstrated by the Alexander the Great and Magnificent Samurai scenarios, and others.

This guide should help you learn the basics of SLIC from the point of view of making y happen when x does, for many different and increasingly complex types of x and y. Very important when SLICing: Have a goal in mind, and have an idea of how you are going to acheive this. This may mean getting very well aquainted with all the functions and events, or at least having a list of them available at any time.

Notes:
Most examples of SLIC coding in this guide do not come from Activision scenarios, as the SLIC in those is fairly complicated, and better examples are available. Consequently, if I refer to "SLIC files", I mean SLIC files other than Activision's *_func.slc and *_msg.slc files.

() - parentheses
[] - square brackets
{} - brackets

Because I'm a lazy git, a lot of the stuff in Locutus' SLIC guide, about Boolean logic, if, for, while, loops and number crunching is not included. It would probably be advisable to read at least the first few chapters of Locutus' Guide first.

Also, I have put the events and handlers section first. This is a dubious idea, as an understanding of variables is needed for almost all other SLICing, but variables are pretty boring, so flick to section 3 as much as you like whilst reading section two, and you will still feel like you're learning how to do it, rather than having to go through the whole dull process of understanding it first.

1.1 Stuff

At this stage I will make some comments about the "C-like syntax" of SLIC, as you shouldn't need to go delving in C tutorials to learn SLIC. Every bracket that is opened { opens a new block of code. This will be dealt with more fully in chapter 4 with the loops, but for now I'll just say that every handler and loop that is opened, needs to be closed, so the game does not give you an error when it goes onto the next handler.
Note that when the bracket is opened, the next line is tabbed forward. This is so that the code is easier to follow. These two examples work eactly the same as each other:

HandleEvent(SleepUnit) 'kill_the_unit' pre { KillUnit(unit[0]); }

HandleEvent(SleepUnit) 'kill_the_unit' pre { KillUnit(unit[0]); }
but when you get into really complicated code with 20 or 30 different loops and brackets, then getting the right thing closed at the right time is very important, and the indentation helps you check that every { has a corresponding } and vice versa.
Also, every line that does not end in { should end with a semi-colon; this is a marker to SLIC that the line has ended.
Comments (bits of writing in the file that are not meant to be read by the game) are denoted using a double slash: //

// everything beyond those slashes isn't read by SLIC. KillUnit(unit[0]); // this also works after lines of code

This may seem like a lot to remember, but when you're writing the code, it becomes second-nature mostly, and most of the time its easier to remember than forget.


back close forward