| 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 |
Logical ANDAnother logical condition used by C++ is the And condition. This condition is a powerful addition to constructing gaming AI.
The Logical AND The Logical AND operation is expressed as: (expression1) && (expression2) The above expressiosn will be evaluated TRUE only if expression1 and expression2 are both TRUE, otherwise the oepration will be evaluated as FALSE. In the NWN2 editor, TRUE is a 1 and FALSE is a 0. Observe that the double && is used to represent the AND operation:
Logical && Example An example of the logical && operation is illustrated in the following program.
The above program compiles without errors. Here are some facts about the program:
Where do we go from here? The next section introduces more decision-making techniques with the introduction of logical OR.
|
|