nC-Script manual
nhttp://www.coniserver.de/down/wdlman.pdf
nOn class website
nIn 3DGS folder?
n
n3DGS Tutorial
nhttp://www.conitec.net/tutorial/index.htm
nAvailable from WED help
n
n
n3DGS Forum
nwww.3dgamestudio.com
nScripting language (no kidding)
nscripting language: A programming language supported by and specific to a particular program. Note: A scripting program is normally used to automate complex or advanced features or procedures within the program.
nSimilar to C or javascript
nCode in .wdl files (plain text)
nNOT object-oriented
nEvent-driven
nMulti-tasking
nCan be extended using DLL plug-ins
n; statement terminator
n{ } enclose function / loop
n“ “ designate text
n[ ] array index
n& array parameter
n< > enclose file definitions
n// comment to end of line
n/* */ block comment
nFixed point number
n999999.999 to – 999999.999
n
nExamples
nVar x;
nVar y = 99;
n
nX = y + 100;
nIndexed variable
nStore numeric data
n
nExamples
nVar x[99];
nVar y[2] = 1,2;
n
nY[0] = x + 1;
nArray in multiple of 3
nStores numeric data
nRelated keywords (x,y,z; red,green,blue; roll,pitch,yaw);
n
nExamples
nVar loc[3];
nVar color_vec = 0,0,0;
n
nLoc[0] = 0;
nLoc.x = 0;
nIndexed variable
nStore text data
n
nExamples
nString t1[30];
nString the_name = “frodo”;
n
nstr_cpy(t1, "hello"); // Good!
nT1 = “hello”; // generates error
nVar = expression
nvar (+-*/)= expression;
n
nX = 1;
nY = x + 1;
nLoc_vector.roll += 2;
nFunction name (parm1, parm2, parm3, parm4) {…}
n
function square(x) {
x = x * x;
return(x); }
nParameters may be variables or arrays
nVariables are scoped locally
nfunction square(x) {…}
nArrays are handled with pointer and changes are global
nfunction square(&x) {…}
n
nstay tuned for more…
nFunctions must be defined before they are used
nFunctions may be “predefined” using a function prototype
nFunction without the {}
n
nExample
function square(x);
function do_math(y) {return (square(y));}
function square(x) {
x = x * x;
return(x); }
/////////////////////////////////////////////////////////////////
// The main() function is started at game start
function main()
{
screen_color.blue = 65; // set a dark blue background
}
var test_var = 1;
string test_str[30];
path "C:\\Program Files\\GStudio\\template";
include <movement.wdl>;
include <messages.wdl>;
/////////////////////////////////////////////////////////////////
// The main() function is started at game start
function main()
{
double_num(test_var);
}
function double_num(num)
{
num *= 2;
str_for_num(test_str, num);
msg_show(test_str,10);
}
action spinner
{
while(1) {
my.pan += 3;
wait(1);
}
}
action spinner2
{
while(1) {
my.pan += 3 * time;
wait(1);
}
}