DIFF

Enforce script essentials

Notefloat ftime; The deltaTime since last frame
Notefloat FLT_MAX; The maximum value for float
Notefloat FLT_MIN; The minimum value for float

Classes

Typedefs

MapIteratorint
TBoolArrayarray<bool>
TClassArrayarray<Class>
TClassClassMapmap<Class, Class>
TClassFloatMapmap<Class, float>
TClassIntMapmap<Class, int>
TClassManagedMapmap<Class, Managed>
TClassManagedRefMapmap<Class, ref Managed>
TClassSetset<Class>
TClassStringMapmap<Class, string>
TClassTypenameMapmap<Class, typename>
TClassVectorMapmap<Class, vector>
TFloatArrayarray<float>
TFloatSetset<float>
TIntArrayarray<int>
TIntClassMapmap<int, Class>
TIntFloatMapmap<int, float>
TIntIntMapmap<int, int>
TIntManagedMapmap<int, Managed>
TIntManagedRefMapmap<int, ref Managed>
TIntSetset<int>
TIntStringMapmap<int, string>
TIntTypenameMapmap<int, typename>
TIntVectorMapmap<int, vector>
TManagedArrayarray<Managed>
TManagedClassMapmap<Managed, Class>
TManagedFloatMapmap<Managed, float>
TManagedIntMapmap<Managed, int>
TManagedManagedMapmap<Managed, Managed>
TManagedManagedRefMapmap<Managed, ref Managed>
TManagedRefArrayarray<ref Managed>
TManagedRefClassMapmap<ref Managed, Class>
TManagedRefFloatMapmap<ref Managed, float>
TManagedRefIntMapmap<ref Managed, int>
TManagedRefManagedMapmap<ref Managed, Managed>
TManagedRefManagedRefMapmap<ref Managed, ref Managed>
TManagedRefSetset<ref Managed>
TManagedRefStringMapmap<ref Managed, string>
TManagedRefTypenameMapmap<ref Managed, typename>
TManagedRefVectorMapmap<ref Managed, vector>
TManagedSetset<Managed>
TManagedStringMapmap<Managed, string>
TManagedTypenameMapmap<Managed, typename>
TManagedVectorMapmap<Managed, vector>
TStringArrayarray<string>
TStringClassMapmap<string, Class>
TStringFloatMapmap<string, float>
TStringIntMapmap<string, int>
TStringManagedMapmap<string, Managed>
TStringManagedRefMapmap<string, ref Managed>
TStringSetset<string>
TStringStringMapmap<string, string>
TStringTypenameMapmap<string, typename>
TStringVectorMapmap<string, vector>
TTypenameArrayarray<typename>
TTypeNameClassMapmap<typename, Class>
TTypeNameFloatMapmap<typename, float>
TTypeNameIntMapmap<typename, int>
TTypeNameManagedMapmap<typename, Managed>
TTypeNameManagedRefMapmap<typename, ref Managed>
TTypenameSetset<typename>
TTypeNameStringMapmap<typename, string>
TTypeNameTypenameMapmap<typename, typename>
TTypeNameVectorMapmap<typename, vector>
TVectorArrayarray<vector>
TypeIDint[]

Functions

private void ~EnScript()
private void ~ScriptModule()
proto native MapIterator Begin()
proto volatile int Call(Class inst, string function, void parm)dynamic call of function when inst == NULL, it's global function call, otherwise it's method of class returns true, when success The call creates new thread, so it's legal to use sleep/wait
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)dynamic call of function when inst == NULL, it's global function call, otherwise it's method of class returns true, when success The call do not create new thread!!!!
proto volatile int CallFunctionParams(Class inst, string function, out void returnVal, Class parms)
proto static Class Cast(Class from)Try to safely down-cast base class to child class.more…
proto static bool CastTo(out Class to, Class from)Try to safely down-cast base class to child class.more…
proto native owned external string ClassName()Returns name of class-typemore…
proto native void Clear() [1/3]Destroyes all elements of the array and sets the Count to 0. The underlying memory of the array is not freed.
proto native void Clear() [2/3]Clears the hash map.
proto native void Clear() [3/3]
proto bool Contains(TKey key)Returns if map contains element with given key.
proto int Copy(notnull array<T> from) [1/3]Copes contents of `from` array to this array.more…
proto int Copy(map<TKey,TValue> from) [2/3]
proto int Copy(set<T> from) [3/3]
proto void copyarray(void destArray, void srcArray)
proto native int Count() [1/3]O(1) complexity.more…
proto native int Count() [2/3]more…
proto native int Count() [3/3]
void Debug() [1/2]Print all elements in arraymore…
void Debug() [2/2]more…
int DifferentAtPosition(array<T> pOtherArray)Returns an index where 2 arrays start to differ from each othermore…
proto native MapIterator End()
private void EnScript()
proto int Find(T value) [1/3]Tries to find the first occurance of given value in the array.more…
proto bool Find(TKey key, out TValue val) [2/3]Search for an element with the given key.more…
proto int Find(T value) [3/3]Tries to find the first occurance of given value in the set.more…
proto T Get(int n) [1/3]more…
proto TValue Get(TKey key) [2/3]Search for an element with the given key.more…
proto T Get(int n) [3/3]
static proto int GetClassVar(Class inst, string varname, int index, out void result)Dynamic read of variable value by its namemore…
string GetDebugName()more…
proto TValue GetElement(int index)Return the i:th element in the map. Note: This operation is O(n) complexity. Use with care!more…
proto TValue GetIteratorElement(MapIterator it)
proto TKey GetIteratorKey(MapIterator it)
proto TKey GetKey(int i)Return the i:th element key in the map. Note: This operation is O(n) complexity. Use with care!more…
array<TKey> GetKeyArray()more…
TKey GetKeyByValue(TValue value)more…
bool GetKeyByValueChecked(TValue value, out TKey key)more…
T GetRandomElement()Returns a random element of arraymore…
int GetRandomIndex()Returns a random index of array. If Count is 0, return index is -1 .more…
array<TValue> GetValueArray()more…
proto volatile void Idle()Yiels execution to other threads and then it continues. Obsolete...
proto int Init(T init[]) [1/2]
proto int Init(T init[]) [2/2]
proto int Insert(T value) [1/3]Inserts element at the end of array.more…
proto bool Insert(TKey key, TValue value) [2/3]Insert new element into hash map.more…
proto int Insert(T value) [3/3]Inserts element at the end of array.more…
void InsertAll(notnull array<T> from)Inserts all elements from arraymore…
void InsertArray(array<T> other)more…
proto int InsertAt(T value, int index) [1/2]Inserts element at certain position and moves all elements behind this position by one.more…
proto int InsertAt(T value, int index) [2/2]Inserts element at certain position and moves all elements behind this position by one.more…
void InsertSet(set<T> other)more…
void Invert()more…
proto native external bool IsInherited(typename type)Returns true when instance is of the type, or inherited one.more…
bool IsValidIndex(int index)more…
proto native int KillThread(Class owner, string name)Kills thread.more…
static proto native ScriptModule LoadScript(ScriptModule parentModule, string scriptFile, bool listing)Do load script and create ScriptModule for itmore…
int MoveIndex(int curr_index, int move_number)Returns a index in array moved by specific numbermore…
proto native MapIterator Next(MapIterator it)
void Obsolete(string msg = "")
proto int ParseString(string input, out string tokens[])Parses string into array of tokens returns number of tokensmore…
proto int ParseStringEx(inout string input, string token)Parses one token from input string. Result is put into token string, and type of token is returned. Input string is left-truncated by the resulting token length.more…
void PrintString(string s)more…
proto native void Release()
proto native void Remove(int index) [1/3]Removes element from array. The empty position is replaced by last element, so removal is quite fast but do not retain order.more…
proto void Remove(TKey key) [2/3]Removes element with given key.
proto native void Remove(int index) [3/3]Removes element from array, but retain all elements ordered.more…
proto void RemoveElement(int i)Removes i:th element with given key. Note: This operation is O(n) complexity. Use with care!more…
void RemoveItem(T value) [1/2]more…
void RemoveItem(T value) [2/2]more…
void RemoveItems(set<T> other)more…
void RemoveItemUnOrdered(T value)more…
proto native void RemoveOrdered(int index)Removes element from array, but retain all elements ordered. It's slower than Removemore…
bool ReplaceKey(TKey old_key, TKey new_key)more…
proto native void Reserve(int newSize)Resizes the array to given size internally. Is used for optimization purposes when the approx. size is known beforehand
proto native void Resize(int newSize)Resizes the array to given size. If the `newSize` is lower than current Count overflowing objects are destroyed. If the `newSize` is higher than current Count missing elements are initialized to zero (null).
proto void reversearray(void param_array)
private proto static bool SafeCastType(Class type, out Class to, Class from)This function is for internal script usage
proto void Set(int n, T value) [1/2]Sets n-th element to given value.
proto void Set(TKey key, TValue value) [2/2]Sets value of element with given key. If element with key not exists, it is created. Note: creating new elements is faster using Insert function.
static proto int SetClassVar(Class inst, string varname, int index, void input)Dynamic write to variable by its namemore…
static proto int SetVar(out void var, string value)Sets variable value by value in stringmore…
void ShuffleArray()more…
proto void Sort(void param_array[], int num) [1/2]Sorts static array of integers(ascendically) / floats(ascendically) / strings(alphabetically)more…
proto native void Sort(bool reverse = false) [2/2]Sorts elements of array, depends on underlaying type.more…
static typename StaticGetType(typename t)Returns typename of class even without a variable or instancemore…
proto external static typename StaticType()Returns typename of object's referencemore…
string String(string s)Helper for passing string expression to functions with void parameter. Example: Print(String("Hello " + var));more…
proto native void Swap(notnull array<T> other) [1/2]Swaps the contents of this and `other` arrays. Does not involve copying of the elements.
proto native void Swap(set<T> other) [2/2]
void SwapItems(int item1_index, int item2_index)more…
proto owned string ThreadFunction(Class owner, string name, int backtrace, out int linenumber)Debug function. Returns current function on stack of the threadmore…
proto external string ToString()
proto native external typename Type()Returns typename of object's classmore…
static proto void Watch(void var, int flags)Debug tool for watching certain variable. Invokes debugger whenever is variable usedmore…

Variables

string m_Msg

Function Documentation

CastClass

proto static Class Cast(Class from)

Try to safely down-cast base class to child class.

Returns: down-casted 'from' pointer when cast is successfull (classes are related), or null if casting is invalid

// assume that Man inheites from Object
Object obj = g_Game.GetPlayer();
Man player = Man.Cast(obj);

if (player)
{
	// horay!
}

CastToClass

proto static bool CastTo(out Class to, Class from)

Try to safely down-cast base class to child class.

Returns: bool true when 'from' is not null and cast successfull, false when casting is not valid or 'from' is null

// assume that Man inheites from Object
Object obj = g_Game.GetPlayer();
Man player;

if (Class.CastTo(player, obj))
{
	// horay!
}



Count [1/3]array

proto native int Count()

O(1) complexity.

Returns: Number of elements of the array


Count [2/3]map

proto native int Count()

Returns: The number of elements in the hashmap.


Debug [1/2]array

void Debug()

Print all elements in array

Returns: void

my_array.Debug();

>> "One"
>> "Two"
>> "Three"
References Count(), string.Format(), Get()
Show 1 more, Print()

Debug [2/2]set

void Debug()
References Count(), string.Format(), Get()
Show 1 more, Print()

DifferentAtPositionarray

int DifferentAtPosition(array<T> pOtherArray)

Returns an index where 2 arrays start to differ from each other

Returns: int Index from where arrays differ

array<int> arr1 = {0,1,2,3};
array<int> arr2 = {0,1,3,2};
int differsAt = arr1.DifferentAtPosition(arr2);
Print(differsAt);

>> 2
References Count(), Count(), ErrorEx()
Show 2 more, Get(), and Get()

Find [1/3]array

proto int Find(T value)

Tries to find the first occurance of given value in the array.

Returns: Index of the first occurance of `value` if found, -1 otherwise


Find [2/3]map

proto bool Find(TKey key, out TValue val)

Search for an element with the given key.

key
The key of the element to find
val
result is stored to val

Returns: returns True if given key exist.

Referenced by AmmoEffects.GetAmmoEffectTypename(), AmmoEffects.GetAmmoParticleID(), AmmoTypesAPI.AddExplosionParticleEffect()
Show 43 more, BaseBuildingBase.DestroyAreaDamage(), CachedEquipmentStorage.ProcessAttachments(), CachedEquipmentStorage.ProcessCargo(), CrashSoundSets.GetSoundSetByHash(), DamageSystem.GetDamageDisplayName(), DayZPlayerCameras.GetTransitionTime(), EasterEgg.PlaySFX(), EmoteManager.CanPlayEmote(), EmoteManager.OnCallbackEnd(), EmoteManager.OnSyncJuncture(), EmoteManager.PlayEmote(), EntityAI.GetSkinningBloodInfectionChance(), ErrorHandlerModuleScript.GetProperties(), ErrorHandlerModuleScript.OnErrorThrown(), ExplosivesBase.AddExplosionEffectForSurface(), ExplosivesBase.GetParticleExplosionID(), FoodStage.CanTransitionToFoodStageType(), FoodStage.GetAllCookingPropertiesForStage(), FoodStage.GetCookingPropertyFromIndex(), FoodStage.GetNextFoodStageType(), FoodStage.GetNutritionPropertyFromIndex(), FoodStage.UpdateVisualsEx(), HiddenSelectionsData.GetHiddenSelectionIndex(), MainMenuData.GetDLCModInfoByName(), MissionServer.EquipCharacter(), ParticleList.GetParticleIDByName(), ParticleList.GetParticlePath(), ParticleList.RegisterParticle(), PlayerBase.GetBloodyHandsPenaltyChancePerAgent(), PlayerListScriptedWidget.Reload(), PlayerListScriptedWidget.ReloadLocal(), PMTF.GetManager(), PPEClassBase.InsertParamValueData(), SEffectManager.EffectUnregister(), SEffectManager.GetCachedSoundParam(), ServerBrowserHelperFunctions.AddMapInfo(), ServerBrowserTab.Unfavorite(), StaminaConsumers.HasEnoughStaminaFor(), StaminaConsumers.HasEnoughStaminaToStart(), StaminaHandler.SetCooldown(), TriggerEffectManager.IsPlayerInTriggerType(), TriggerEffectManager.OnPlayerEnter(), and TriggerEffectManager.OnPlayerExit()


Get [1/3]array

proto T Get(int n)

Returns: Element at the index `n`


Get [2/3]map

proto TValue Get(TKey key)

Search for an element with the given key.

key
The key of the element to find

Returns: Pointer to element data if found, NULL otherwise.


GetClassVarEnScript

static proto int GetClassVar(Class inst, string varname, int index, out void result)

Dynamic read of variable value by its name

inst
When inst == NULL, it's for global variable, otherwise it's class member
index
Is index when variable is array
out result
Variable must be of the same type!

Returns: int true when success

float count = 0;

bool success = EnScript.GetClassVar(myClass, "m_Counter", 0, count);
Print(count);
Print(success);

>> count = 5
>> success = 1


GetElementmap

proto TValue GetElement(int index)

Return the i:th element in the map. Note: This operation is O(n) complexity. Use with care!

index
The position of the element in the map

Returns: The element on the i:th position


GetKeymap

proto TKey GetKey(int i)

Return the i:th element key in the map. Note: This operation is O(n) complexity. Use with care!

i
The position of the element key in the map

Returns: Return key of i-th element




GetKeyByValueCheckedmap

bool GetKeyByValueChecked(TValue value, out TKey key)
References Count(), GetElement(), and GetKey()


GetRandomIndexarray

int GetRandomIndex()

Returns a random index of array. If Count is 0, return index is -1 .

Returns: int Random index of array

Print( my_array.GetRandomIndex() );

>> 2
References Count(), and Math.RandomInt()


Insert [1/3]array

proto int Insert(T value)

Inserts element at the end of array.

value
Element to be inserted

Returns: Position at which element is inserted


Insert [2/3]map

proto bool Insert(TKey key, TValue value)

Insert new element into hash map.

key
Key of element to be inserted.
value
Data of element to be inserted.

Insert [3/3]set

proto int Insert(T value)

Inserts element at the end of array.

value
Element to be inserted

Returns: Position at which element is inserted


InsertAllarray

void InsertAll(notnull array<T> from)

Inserts all elements from array

from
array<T> array from which all elements will be added
TStringArray arr1 = new TStringArray;
arr1.Insert( "Dave" );
arr1.Insert( "Mark" );
arr1.Insert( "John" );

TStringArray arr2 = new TStringArray;
arr2.Insert( "Sarah" );
arr2.Insert( "Cate" );

arr1.InsertAll(arr2);

for ( int i = 0; i < arr1.Count(); i++ )
{
	Print( arr1.Get(i) );
}

delete arr2;
delete arr1;

>> "Dave"
>> "Mark"
>> "John"
>> "Sarah"
>> "Cate"
References Count(), Get(), and Insert()



InsertAt [2/2]set

proto int InsertAt(T value, int index)

Inserts element at certain position and moves all elements behind this position by one.

value
Element to be inserted
index
Position at which element is inserted. Must be less than Array::GetCardinality()

Returns: Number of elements after insertion




IsInheritedClass

proto native external bool IsInherited(typename type)

Returns true when instance is of the type, or inherited one.

type
Class type

Returns: bool true when 'clType' is the same as 'type', or inherited one.

if (inst && inst.IsInherited(Widget))
{
	Print("inst is inherited from Widget class!");
}


KillThread

proto native int KillThread(Class owner, string name)

Kills thread.

owner
Can be NULL for global threads.
name
Name of the first function on stack

Returns: int ???

???

LoadScriptScriptModule

static proto native ScriptModule LoadScript(ScriptModule parentModule, string scriptFile, bool listing)

Do load script and create ScriptModule for it

parentModule
Module
scriptFile
Script path
listing
??

Returns: ScriptModule Loaded scripted module

???

MoveIndexarray

int MoveIndex(int curr_index, int move_number)

Returns a index in array moved by specific number

Returns: int Moved index in this array

Print( "Count: "+ my_array.Count() );
Print( "Moved 1:"+ my_array.MoveIndex(2, 1) );
Print( "Moved 3:"+ my_array.MoveIndex(2, 2) );

>> "Count: 4"
>> "Moved index 2 by 1: 3";
>> "Moved index 2 by 2: 0";
References Count()

ParseString

proto int ParseString(string input, out string tokens[])

Parses string into array of tokens returns number of tokens

input
string String for parse
out tokens
array[] Parsed string in array

Returns: int Number of tokens

string token[2];
int result = ParseString("Hello World", token);

for( int i = 0; i < 2; i++ )
{
	Print(token[i]);
}

>> 'Hello'
>> 'World'

ParseStringEx

proto int ParseStringEx(inout string input, string token)

Parses one token from input string. Result is put into token string, and type of token is returned. Input string is left-truncated by the resulting token length.

[in,out] input string String for parse\ Output is without founded token
out token
string Founded string token

Returns: int Type of token \verbatim Token types: 0 - error, no token 1 - defined token (special characters etc. . / * ) 2 - quoted string. Quotes are removed -> TODO 3 - alphabetic string 4 - number 5 - end of line -> TODO \endverbatim

string input = "Hello*World";
string token1;
string token2;

int result1 = ParseStringEx(input, token1);
int result2 = ParseStringEx(input, token2);

Print( String( "Token1 = '" + token1 + "' Type = " + result1.ToString() ) );
Print( String( "Token2 = '" + token2 + "' Type = " + result2.ToString() ) );
Print( input );

>> 'Toke1 = 'Hello' Type = 3'
>> 'Toke1 = '*' Type = 1'


Remove [1/3]array

proto native void Remove(int index)

Removes element from array. The empty position is replaced by last element, so removal is quite fast but do not retain order.

index
Index of element to be removed


RemoveElementmap

proto void RemoveElement(int i)

Removes i:th element with given key. Note: This operation is O(n) complexity. Use with care!

i
The position of the element key in the map



RemoveItemsset

void RemoveItems(set<T> other)
References Count(), and RemoveItem()

RemoveItemUnOrderedarray

void RemoveItemUnOrdered(T value)
References Find(), and Remove()

RemoveOrderedarray

proto native void RemoveOrdered(int index)

Removes element from array, but retain all elements ordered. It's slower than Remove

index
Index of element to be removed

ReplaceKeymap

bool ReplaceKey(TKey old_key, TKey new_key)
References Contains(), Get(), Remove()
Show 1 more, Set()

SetClassVarEnScript

static proto int SetClassVar(Class inst, string varname, int index, void input)

Dynamic write to variable by its name

inst
when inst == NULL, it's for global variable, otherwise it's class member
varname
index
Is index when variable is array
input
Input variable must be of the same type!

Returns: int Returns true(1) when success

Print(myClass.m_Counter);

>> m_Counter = 0

bool success = EnScript.SetClassVar(myClass, "m_Counter", 0, 5.0);

Print(myClass.m_Counter);
Print(success);

>> m_Counter = 5
>> success = 1

SetVarEnScript

static proto int SetVar(out void var, string value)

Sets variable value by value in string

out var
value

Returns: int

???


Sort [1/2]

proto void Sort(void param_array[], int num)

Sorts static array of integers(ascendically) / floats(ascendically) / strings(alphabetically)

param_array
array Array to sort
num
int How many items will be sorted in array

Returns: void

string	arrStr[3] = {"Dog", "Car", "Apple"};
Sort(arrStr, 2)
for ( int x = 0; x < 3; x++ )
{
	Print( arrStr[x] );
}

>> 'Car'
>> 'Dog'
>> 'Apple'


StaticGetTypeClass

static typename StaticGetType(typename t)

Returns typename of class even without a variable or instance

Returns: typename class-type

typename eAITypename = StaticGetType(EntityAI);

StaticTypeClass

proto external static typename StaticType()

Returns typename of object's reference

Returns: typename class-type

EntityAI e;
Print(e.StaticType());

>> 'EntityAI'


SwapItemsarray

void SwapItems(int item1_index, int item2_index)
References Get(), and Set()

ThreadFunction

proto owned string ThreadFunction(Class owner, string name, int backtrace, out int linenumber)

Debug function. Returns current function on stack of the thread

owner
Can be NULL for global threads
name
Name of the first function on stack
backtrace
???
linenumber
???

Returns: string ???

???

TypeClass

proto native external typename Type()

Returns typename of object's class

Returns: typename class-type

Man player = g_Game.GetPlayer();
typename type = player.Type();
Print(type.ToString());

>> 'Man'

WatchEnScript

static proto void Watch(void var, int flags)

Debug tool for watching certain variable. Invokes debugger whenever is variable used

var
Certain variable for watching
flags
= 1 means it will break even when not modified

Returns: void