Enforce Script Syntax – DayZ
(Change) |
No edit summary |
||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
Enforce Script is the language that is used by the Enfusion engine first introduced in DayZ Standalone. It is a Object-Oriented Scripting Language (OOP) that works with objects and classes. | |||
== Operators == | == Operators == | ||
Line 35: | Line 35: | ||
'''Basic Class''' | '''Basic Class''' | ||
<syntaxhighlight lang=cpp> | |||
class MyClass | |||
{ | |||
private string _test; | |||
void MyClass() | |||
{ | |||
// Constructor that will be called when class gets instantiated | |||
} | |||
string getTest() | |||
{ | |||
return _test; | |||
} | |||
string setTest(value) | |||
{ | |||
_test = value; | |||
} | |||
} | |||
</syntaxhighlight> | |||
'''Modded class'''<br> | '''Modded class'''<br> | ||
In order to get your custom code to work and function on top of another class already in the game, a modded class is where you want to turn to. | In order to get your custom code to work and function on top of another class already in the game, a modded class is where you want to turn to. | ||
<syntaxhighlight lang=cpp> | |||
modded class PlayerBase | |||
{ | |||
override void EEKilled(Object killer) | |||
{ | |||
// This will call the method in which you are overriding. | |||
// Do this if you want to keep the original functionality | |||
super().EEKilled; | |||
// Custom code here (i.e. Print(killer.GetIdentity().GetName())) | |||
} | |||
} | |||
</syntaxhighlight> | |||
[[Category:DayZ:Scripting|DayZ:Scripting]] |
Revision as of 12:26, 17 December 2018
Enforce Script is the language that is used by the Enfusion engine first introduced in DayZ Standalone. It is a Object-Oriented Scripting Language (OOP) that works with objects and classes.
Operators
Arithmetic Operators
Add +
Subtract -
Multiply *
Divide /
Assignments
Define value to variable =
Increment variable by value +=
Decrement variable by value -=
Multiply variable by value *=
Divide variable by value /=
Increment variable by 1 ++
Decrement variable by 1 --
Comparison
More than value >
Less than value <
More or equal to the value >=
Less or equal to the value <=
Classes and Objects
Classes can be seen as a blueprint of an object. An object is an instance of a class. A class can have more than one object.
Instantiate (create a new instance) a class MyClass myClass = new MyClass();
Access attributes and methods inside a class by using dot notation. myClass.myMethod()
Basic Class
class MyClass
{
private string _test;
void MyClass()
{
// Constructor that will be called when class gets instantiated
}
string getTest()
{
return _test;
}
string setTest(value)
{
_test = value;
}
}
Modded class
In order to get your custom code to work and function on top of another class already in the game, a modded class is where you want to turn to.
modded class PlayerBase
{
override void EEKilled(Object killer)
{
// This will call the method in which you are overriding.
// Do this if you want to keep the original functionality
super().EEKilled;
// Custom code here (i.e. Print(killer.GetIdentity().GetName()))
}
}