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

True/False Conditions

The NWN2 editor allows ffor variable settings to either TRUE or FALSE. This is helpful when you need to check for only two conditions. This section gives an example of how that is done.


Creating Variables for True or False Conditions

The NWN2 data type int allows for two special conditions. These are TRUE and FALSE (they must be all uppercsae to work). The following program illustrates:

void main();

 {

  int Condition1;

  int Condition2;

  Condition1=TRUE;

   Condition2=False;

 }

 


The above program compiles without errors. Note that both declared variables, Condition1 and Condition2 are of data type int. However, in the NWN2 scripting editor they can be set to either a TRUE or a FALSE condition. These conditions can now be checked in logical operations for their conditions. This is illustrated in the next example.

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.