DayZ 1.24
Loading...
Searching...
No Matches
tools.c File Reference

Go to the source code of this file.

Classes

class  ScriptCallQueue
 ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but later during frame update (used mainly in UI)
usage: More...
 
class  ScriptInvoker
 ScriptInvoker Class provide list of callbacks
usage: More...
 

Enumerations

enum  EScriptInvokerInsertFlags
 

Functions

enum EScriptInvokerInsertFlags ScriptCaller ()
 Designed to hold 1 valid call.
 
static proto ScriptCaller Create (func fn)
 Creates a ScriptCaller.
 
proto void Init (func fn)
 Replaces the current registered func with the new one, throws errors if unsuccessful.
 
proto void Invoke (void param1=null, void param2=null, void param3=null, void param4=null, void param5=null, void param6=null, void param7=null, void param8=null, void param9=null)
 Invoke call on the registered func, throws errors if unsuccessful.
 
proto bool IsValid ()
 Checks if the ScriptCaller is valid.
 
proto bool Equals (notnull ScriptCaller other)
 Compares this script caller against another script caller.
 

Variables

enum EScriptInvokerInsertFlags NONE
 
enum EScriptInvokerInsertFlags ALL
 Default flag.
 
 IMMEDIATE
 It gets added in immediately, which means that when called while an invoker is running, it will call this newly added call in the same run.
 
 UNIQUE
 Only one call to this instance+method is ever expected.
 

Enumeration Type Documentation

◆ EScriptInvokerInsertFlags

Definition at line 129 of file tools.c.

130{
131 NONE,
138 IMMEDIATE,
144 UNIQUE,
145}
IMMEDIATE
It gets added in immediately, which means that when called while an invoker is running,...
Definition tools.c:7
UNIQUE
Only one call to this instance+method is ever expected.
Definition tools.c:13
enum EScriptInvokerInsertFlags NONE
Definition tools.c:0

Function Documentation

◆ Create()

static proto ScriptCaller Create ( func fn)
static

Creates a ScriptCaller.

◆ Equals()

proto bool Equals ( notnull ScriptCaller other)

Compares this script caller against another script caller.

Note
May return true even if either one is invalid
class SomeClass
{
void SomeMethod()
{
}
}
void Test()
{
callerA = ScriptCaller.Create(instanceA.SomeMethod);
callerB = ScriptCaller.Create(instanceA.SomeMethod);
Print(callerA.Equals(callerB));
callerA = ScriptCaller.Create(instanceA.SomeMethod);
callerB = ScriptCaller.Create(instanceB.SomeMethod);
Print(callerA.Equals(callerB));
}
enum EScriptInvokerInsertFlags ScriptCaller()
Designed to hold 1 valid call.
proto void Print(void var)
Prints content of variable to console/log.

◆ Init()

proto void Init ( func fn)

Replaces the current registered func with the new one, throws errors if unsuccessful.

◆ Invoke()

proto void Invoke ( void param1 = null,
void param2 = null,
void param3 = null,
void param4 = null,
void param5 = null,
void param6 = null,
void param7 = null,
void param8 = null,
void param9 = null )

Invoke call on the registered func, throws errors if unsuccessful.

◆ IsValid()

override bool IsValid ( )

Checks if the ScriptCaller is valid.

Checks if the ScriptCaller is valid.

Definition at line 130 of file CfgPlayerSpawnDataJson.c.

131 {
132 if (!super.IsValid())
133 return false;
134
135 if (spawnWeight < 1)
136 {
137 Debug.Log("Invalid spawnWeight set for a discrete item set!", "n/a", "Validation", "PlayerSpawnPresetDiscreteItemSetBase");
138 return false;
139 }
140 return true;
141 }
PlayerSpawnPresetItemSetBase spawnWeight
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133

References discreteItemSets, Debug::Log(), slotName, and spawnWeight.

◆ ScriptCaller()

enum EScriptInvokerInsertFlags ScriptCaller ( )

Designed to hold 1 valid call.

ScriptCaller is meant to be created through Create

Variable Documentation

◆ ALL

Default flag.

Note
Don't use this if you want it to remove only the last insert instead of all of them

◆ IMMEDIATE

IMMEDIATE

It gets added in immediately, which means that when called while an invoker is running, it will call this newly added call in the same run.

Note
Default flag, as that is the original behaviour, although it might cause endless Insert chain now... (still better than undefined behaviour)
In case of "Possible endless Insert detected" VME, either create an exit, remove the IMMEDIATE flag or make the insert UNIQUE
The Endless Insert is detected by seeing if "amount of calls > initial size + 128"

Definition at line 7 of file tools.c.

◆ NONE

@ NONE

Definition at line 0 of file tools.c.

◆ UNIQUE

UNIQUE

Only one call to this instance+method is ever expected.

Note
Will throw a VME when a second one is attempted to be added
If it was already added without the flag, it will also throw a VME and keep the first of all previously inserted

Definition at line 13 of file tools.c.