You are on page 1of 3

Here's a quick tutorial on how to do some scripting for CoD. If it would be bett er as a video, I can do that as well.

Note: you need to have some programming kn owledge to understand most of this! Intro CoDScript is basically a scaled-down version of C. If you know C/C++/Java/PHP yo u'll be able to learn this language. It's very simple. There are some major diff erences between these languages and CoDScript though! Variables For variables, you don't have to initialize them. Ever. Take this code for examp le: [C] int variable = 1; printf( "%d", variable ); [GSC] variable = 1; iPrintLn( variable ); Because you don't have to initialize the variable and define what type it's goin g to be, you can have variables that can change types all the time. [C] // would cause compiler errors int variable = 1; variable = "a string"; variable = 1.46899; // works variable variable variable just fine = 1; = "a string"; = 1.46899;

Never having to initialize variables is nice in a way, but also can be bad if yo u have a variable that is SUPPOSED to be an int, but really is a string.

There are MANY types of variables in CoDScript. All the standard C ones apply, w ith the addition of CoD-specific variables. [C] int float double char

1 3.14159 1.22 'c'

As with variables. you cannot include any files or really make any 'C'-style global d efines. [GSC] // calling a function in another file . 3) x.file is _coolfile. you don't have to specify types in the parameters either. void coolFunction().[GSC] bool string localized string entity struct vector true/false "text" &"text" players. you would do things like this: [C] // including function/calling it #include <stdio. [C] int main(). [C] char* getName( entity_t ent ) { // code } [GSC] getName( ent ) { // code } [b]Other notes[/b] CoDScript does [b]NOT[/b] support any pre-processor directives (those that start with #)! So. Instead. [GSC] main(). except as types (1. getMahFloat(). 2. . you don't have to create functions with return types. models structures of data like in C. float getMahFloat().z Unlike C. coolFunction().gsc in the maps\ folde r maps\_coolfile::printf( "this" ).y. [[ variable ]]( "this" ).h> printf( "Cool stuff!" ).

[C] // old C-Style #define VAR 1 // CoD level.coolFunction = maps\_utility::loadThisAndThat. Stay tuned for some more tutorials on CoDScripting. In the same way. // somewhere else in another file [[ level.var = 1. you can use the 'level' variable. Closing So now you know a bit more about how to script for CoD! Check out the [url=http: //www.com/Script]script reference[/url] to see all the built-in functions available (this is a CoD4 reference.To set global variables.[/quote] . although most of the functions work in CoD1 ).zeroy.coolFunction ]](). you can actually make 'level' variables contain links to functi ons in other files! level.