Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIDebug.c
Go to the documentation of this file.
1
2
[
BaseContainerProps
(configRoot:
true
)]
3
class
SCR_AIDebug
: SCR_GameCoreBase
4
{
5
const
string
logFileName =
"$logs:ai_script.log"
;
6
7
protected
static
ref
SCR_AIDebug
s_Instance
;
8
9
protected
ref
FileHandle
m_FileHandle
;
10
11
//------------------------------------------------------------------------------------------------
13
static
SCR_AIDebug
GetInstance
()
14
{
15
return
s_Instance
;
16
}
17
18
//------------------------------------------------------------------------------------------------
19
override
void
OnGameStart
()
20
{
21
s_Instance
=
this
;
22
23
#ifdef AI_DEBUG
24
m_FileHandle
=
FileIO
.OpenFile(logFileName,
FileMode
.WRITE);
25
if
(!
m_FileHandle
)
26
Print
(
"SCR_AIDebug: Failed to create log file"
,
LogLevel
.ERROR);
27
#endif
28
}
29
30
//------------------------------------------------------------------------------------------------
31
override
void
OnGameEnd
()
32
{
33
if
(
m_FileHandle
)
34
{
35
m_FileHandle
.Close();
36
m_FileHandle
= null;
37
}
38
39
if
(
s_Instance
)
40
{
41
s_Instance
= null;
42
}
43
}
44
45
//------------------------------------------------------------------------------------------------
49
static
string
GetBehaviorName
(
SCR_AIBehaviorBase
behavior)
50
{
51
if
(!behavior)
52
return
""
;
53
54
return
behavior.Type().ToString();
55
}
56
57
#ifdef AI_DEBUG
58
//------------------------------------------------------------------------------------------------
62
static
void
DebugLog(
string
str,
LogLevel
logLevel =
LogLevel
.DEBUG)
63
{
64
SCR_AIDebug
inst =
GetInstance
();
65
66
if
(!inst.
m_FileHandle
)
67
return
;
68
69
// Resolve out log level
70
bool
copyToStdLog =
false
;
71
string
logLevelStr;
72
switch
(logLevel)
73
{
74
case
LogLevel
.SPAM: logLevelStr =
"S"
;
break
;
75
case
LogLevel
.VERBOSE: logLevelStr =
"v"
;
break
;
76
case
LogLevel
.DEBUG: logLevelStr =
"D"
;
break
;
77
case
LogLevel
.NORMAL: logLevelStr =
"N"
;
break
;
78
case
LogLevel
.WARNING: logLevelStr =
"W"
; copyToStdLog =
true
;
break
;
79
case
LogLevel
.ERROR: logLevelStr =
"E"
; copyToStdLog =
true
;
break
;
80
case
LogLevel
.FATAL: logLevelStr =
"F"
; copyToStdLog =
true
;
break
;
81
}
82
83
// Get time
84
int
hr, min, sec;
85
System.GetHourMinuteSecond(hr, min, sec);
86
int
ticks = System.GetTickCount();
87
88
// Format string
89
string
formattedStr =
string
.Format(
90
"%1:%2:%3 %4 (%5): %6"
,
91
hr.ToString(2),
92
min.ToString(2),
93
sec.ToString(2),
94
ticks,
95
logLevelStr,
96
str
97
);
98
99
inst.
m_FileHandle
.Write(formattedStr);
100
inst.
m_FileHandle
.Write(
"\n"
);
101
102
if
(copyToStdLog)
103
Print
(str, logLevel);
104
}
105
#endif
106
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_AIBehaviorBase
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
Definition
SCR_AIBehavior.c:23
FileHandle
Definition
FileHandle.c:69
FileIO
Definition
FileIO.c:13
SCR_AIDebug
Game core which persists through whole game and stores various data for AI debugging.
Definition
SCR_AIDebug.c:4
SCR_AIDebug::GetBehaviorName
static string GetBehaviorName(SCR_AIBehaviorBase behavior)
Definition
SCR_AIDebug.c:49
SCR_AIDebug::m_FileHandle
ref FileHandle m_FileHandle
Definition
SCR_AIDebug.c:9
SCR_AIDebug::s_Instance
static ref SCR_AIDebug s_Instance
Definition
SCR_AIDebug.c:7
SCR_AIDebug::OnGameEnd
override void OnGameEnd()
Definition
SCR_AIDebug.c:31
SCR_AIDebug::GetInstance
static SCR_AIDebug GetInstance()
Definition
SCR_AIDebug.c:13
SCR_AIDebug::OnGameStart
override void OnGameStart()
Definition
SCR_AIDebug.c:19
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
FileMode
FileMode
Mode for opening file. See FileSystem::Open.
Definition
FileMode.c:14
scripts
Game
AI
SCR_AIDebug.c
Generated by
1.17.0