NWN2 Scripting.




Simulation Training.

Introduction
Home
First Program
Seeing Results
Variables and Data Types
Comments
Functions
Data Conversion
Random Numbers
Concatenation
Arithmetic Operators
Compound Assignments
One More or Less
Precedence
Relational Operators
The Open Branch
The Closed Branch
Logical AND
Logical OR
Compound Statements
ELSE If
Switch Case
The ? Operator
The for Loop
The while Loop
The do while Loop
Introduction to Functions
Passing Values
Passing Multiple Values
Multiple Functions
Simplifying Functions
TRUE/fALSE Conditions
Return Values
Setting Global Variables
Getting Global Variables
Setting Local Variables
Getting Local Variables
WayPoints Introduction
Static Waypoint Sets
Dynamic Waypoint Sets
Dynamic WP Cycles
Input Output

Comments

Comments are used for the purpose of helping explain all or parts of the program to the programmer. Comments do not have any affect on the program itself. When the program is compiled, comments are ignored and preform no action during program execution. In the NWN2 editor, you will find many sources of already completed code. You will also find that they contain comments to help you understand what the code is suppose to do. You too should use comments in the code that you write. Doing so will help you remember what you intended different parts of your program to do.


Coding a Comment

The program below illustrates two different ways of putting comments into a program.

//This is a comment.
/*This is a multiple line comment which continues on to this line
   and ends on this line. */
void main( )
{
 //Comments may be placed anywhere in the program.
  string ElfName; //The name of the elf.
  string OrcName; //The name of the orc.
}

The above program compiles without errors. Here are some facts about comments:
• A single line comment starts with the //
• A multiple line comment starts with the /* and ends with the */.


Where do we go from here?

Now that we know how to do comments and declare variable as well as assigning them values, we are ready to try some really exciting code.


 

Nwn2Scripting provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 2008 by Adamson House, Ltd. All Rights Reserved.

Questions or Comments: EMail Webmaster

Donations are to Adamson House, Ltd who maintains this site.
All donations go the the improvement of this site.