Enforce Script Syntax – Arma Reforger
Enforce Script is the language that is used by the Enfusion engine first introduced in DayZ Standalone. It is an Object-Oriented scripting language that works with objects and classes and is similar to the C# programming language.
Data Types
See Scripting: Values - Types.
Object-Oriented Programming
See Object Oriented Programming Basics and Object Oriented Programming Advanced Usage.
Operations
Assignation
Assignation operations cast the first value to the expected type; see below:
// adding int and int
int result = 1 + 2; // result == 3
// adding float and float
float result = 1.25 + 2.75; // result == 4
// adding int and float
int result = 1 + 0.9; // result == 1 - int truncates a float result
int result = 0.9 + 0.9 + 0.9; // result == 2 - 2.7 truncated to 2
float result = 0.9 + 0.9 + 0.9; // result == 2.7
float result = 1 + 1.9; // result == 2.9
float result = 1.9 + 1; // result == 2.9
bool invalid = new SCR_Ray(); // error
SCR_Ray instance = new SCR_Ray();
bool valid = instance; // valid == true
Logic
SCR_Ray instance = new SCR_Ray();
if (instance) // identical to "instance != null"
Print("Instance exists");
else
Print("Instance does not exists");
string text;
if (text) // identical to "!text.IsEmpty()"
Print("Text is not empty");
else
Print("Text is empty");
int val = 42; // same with float
if (val) // identical to "val != 0"
Print("Val is not zero");
else
Print("Val is zero");