This page will attempt to explain the basic facts about operators that are needed in order to get started. For a more in depth explanation when you are more confident with UnrealScript you can simply search the Unreal Wiki or UDN for any topics about operators.
“An operator is used to perform a specific operation on a set of operands in an expression.” – O’Reilly, C++ Pocket Reference.
Here is a list of the most commonly used operators. As a beginner, you need only understand the following in order to get started coding. The full set of opeartors are defined in the Object class.
Operator | Relevant Variable Type | Description |
---|---|---|
@ | string | Joins two strings together with a space |
@= | string | Joins two strings together with a space and assign |
$ | string | Joins two strings together |
$= | string | Joins two strings together and assign |
*= | byte, int, float, vector, rotator | Multiply and assign |
/= | byte, int, float, vector, rotator | Divide and assign |
+= | byte, int, float, vector | Add and assign |
-= | byte, int, float, vector | Subtract and assign |
|| | bool | Logical OR |
&& | bool | Logical AND |
= | all | Assign, example: intA = intB |
== | all | Comparison, example: does intA == intB? |
< | byte, int, float, string | Less than |
> | byte, int, float, string | Greater than |
<= | byte, int, float, string | Less than or equal to |
>= | byte, int, float, string | Greater than or equal to |
~= | float, string | Approximately equal, within 0.0001 for float, case-insensitive for strings. |
+ | byte, int, float, vector | Add |
– | byte, int, float, vector | Subtract |
* | byte, int, float, vector, rotator | Multiply |
/ | byte, int, float, vector, rotator | Divide |
! | bool | Logical NOT, example 1: boolA = !boolB (boolA equals NOT boolb), example 2: if(!boolA) (if boolA is false) |
++ | byte, int, rotator sub-variables | Increment by 1, can be used before or after the variable |
— | byte, int, rotator sub-variables | Decrement by 1, can be used before or after the variable |
TIP – UnrealScript is not case sensitive.
Recent Comments