Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
dayztools.c
Go to the documentation of this file.
1
class
DayZTool
:
WorkbenchPlugin
2
{
3
void
RunDayZBat
(
string
filepath,
bool
wait =
false
)
4
{
5
if
(filepath.
Length
() < 2)
return
;
6
7
filepath.
Replace
(
"\\"
,
"/"
);
8
9
if
(filepath[1] !=
":"
)
10
{
11
string
cwd;
12
Workbench
.
GetCwd
(cwd);
13
filepath = cwd +
"/"
+ filepath;
14
}
15
16
int
index = filepath.
IndexOf
(
"/"
);
17
int
last_index = index;
18
19
while
(index != -1)
20
{
21
last_index = index;
22
index = filepath.
IndexOfFrom
(last_index + 1,
"/"
);
23
}
24
25
if
(last_index == -1)
return
;
26
27
string
path
= filepath.
Substring
(0, last_index);
28
string
bat = filepath.
Substring
(last_index + 1, filepath.
Length
() - last_index - 1);
29
/*Print(filepath);
30
Print(path);
31
Print(bat);*/
32
Workbench
.
RunCmd
(
"cmd /c \"cd "
+
path
+
" & call "
+ bat +
"\""
, wait);
33
}
34
35
override
void
Configure
()
36
{
37
Workbench
.
ScriptDialog
(
"Mission directory"
,
""
,
this
);
38
}
39
40
[
ButtonAttribute
(
"OK"
)]
41
void
DialogOk
()
42
{
43
}
44
};
45
46
[
WorkbenchPluginAttribute
(
"DayZ Restart"
,
"Just for testing"
,
"ctrl+1"
,
""
, {
"ScriptEditor"
})]
47
class
RestartDayzTool
:
DayZTool
48
{
49
[
Attribute
(
"day_z_data_missions/killDayZ.bat"
,
"fileeditbox"
,
"Path to missions dir"
,
""
)]
50
string
KillBatPath
;
51
52
[
Attribute
(
"day_z_data_missions/_default_single/default_SampleMap3_Empty.bat"
,
"fileeditbox"
,
"Path to missions dir"
,
""
)]
53
string
MissionBatPath
;
54
55
override
void
Run
()
56
{
57
RunDayZBat
(
KillBatPath
,
true
);
58
RunDayZBat
(
MissionBatPath
);
59
}
60
}
61
62
[
WorkbenchPluginAttribute
(
"DayZ Run"
,
"Just for testing"
,
"ctrl+2"
,
""
, {
"ScriptEditor"
})]
63
class
RunDayzTool:
DayZTool
64
{
65
[
Attribute
(
"day_z_data_missions/_default_single/default_SampleMap3_Empty.bat"
,
"fileeditbox"
,
"Path to missions dir"
,
""
)]
66
string
MissionBatPath
;
67
68
override
void
Run
()
69
{
70
RunDayZBat(
MissionBatPath
);
71
}
72
}
73
74
[
WorkbenchPluginAttribute
(
"DayZ Kill"
,
"Just for testing"
,
"ctrl+3"
,
""
, {
"ScriptEditor"
})]
75
class
KillDayzTool
:
DayZTool
76
{
77
[
Attribute
(
"day_z_data_missions/killDayZ.bat"
,
"fileeditbox"
,
"Path to missions dir"
,
""
)]
78
string
KillBatPath
;
79
80
override
void
Run
()
81
{
82
RunDayZBat
(
KillBatPath
);
83
}
84
}
85
86
87
88
89
Attribute
Definition
enentity.c:826
ButtonAttribute
Definition
workbenchapi.c:118
DayZTool
Definition
dayztools.c:2
DayZTool::DialogOk
void DialogOk()
Definition
dayztools.c:41
DayZTool::RunDayZBat
void RunDayZBat(string filepath, bool wait=false)
Definition
dayztools.c:3
DayZTool::Configure
override void Configure()
Definition
dayztools.c:35
KillDayzTool
Definition
dayztools.c:76
KillDayzTool::Run
override void Run()
Definition
dayztools.c:80
KillDayzTool::KillBatPath
string KillBatPath
Definition
dayztools.c:78
RestartDayzTool
Definition
dayztools.c:48
RestartDayzTool::Run
override void Run()
Definition
dayztools.c:55
RestartDayzTool::MissionBatPath
string MissionBatPath
Definition
dayztools.c:53
RestartDayzTool::KillBatPath
string KillBatPath
Definition
dayztools.c:50
Workbench
Definition
workbenchapi.c:7
Workbench::GetCwd
static proto void GetCwd(out string currentDir)
Workbench::ScriptDialog
static proto int ScriptDialog(string caption, string text, Class data)
Workbench::RunCmd
static proto native int RunCmd(string command, bool wait=false)
WorkbenchPlugin::WorkbenchPlugin
void WorkbenchPlugin()
Run
override void Run()
Starts the testing process. Returns true when all tests have finished. If some of them are still in p...
Definition
dayztools.c:69
MissionBatPath
string MissionBatPath
Definition
dayztools.c:67
WorkbenchPluginAttribute
RestartDayzTool DayZTool WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})
Definition
dayztools.c:62
string::Substring
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
string::IndexOf
proto native int IndexOf(string sample)
Finds 'sample' in 'str'.
string::IndexOfFrom
proto native int IndexOfFrom(int start, string sample)
Finds 'sample' in 'str' from 'start' position.
string::Replace
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
string::Length
proto native int Length()
Returns length of string.
path
string path
Definition
optionselectormultistate.c:142
Games
Dayz
scripts
editor
plugins
dayztools.c
Generated by
1.17.0