void main()

This function declaration is necessary for all scripts with the exception of conversation scripts, and #include files. All statements to be executed should fall within this function's code block. Any custom functions used within the main() code block should be declared before it (above the void main() line) by declaring a function or using a function prototype.

// declaration of a function
int getAge(object oPC) 
{
     // ...
     return 0;
}

// function prototype (this function body appears after
// void main()
string getName(object oPC);
 
// main program execution
void main()
{
     // main code block
     PrintString(getName(GetFirstPC()));
     PrintInteger(getAge(GetFirstPC()));
}

// our "getName" function body appears below (after 
// void main() so it was prototyped above)
string getName(object oPC)
{
     return "";
}




 author: Ryan Hunt, editor: Lilac Soul, additional contributor(s): Mike Mooney