Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
dayztools.c
Go to the documentation of this file.
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"})]
48{
49 [Attribute("day_z_data_missions/killDayZ.bat", "fileeditbox", "Path to missions dir", "")]
51
52 [Attribute("day_z_data_missions/_default_single/default_SampleMap3_Empty.bat", "fileeditbox", "Path to missions dir", "")]
54
55 override void Run()
56 {
59 }
60}
61
62[WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})]
63class RunDayzTool: DayZTool
65 [Attribute("day_z_data_missions/_default_single/default_SampleMap3_Empty.bat", "fileeditbox", "Path to missions dir", "")]
66 string MissionBatPath;
68 override void Run()
69 {
70 RunDayZBat(MissionBatPath);
71 }
72}
73
74[WorkbenchPluginAttribute("DayZ Kill", "Just for testing", "ctrl+3", "", {"ScriptEditor"})]
76{
77 [Attribute("day_z_data_missions/killDayZ.bat", "fileeditbox", "Path to missions dir", "")]
79
80 override void Run()
81 {
83 }
84}
85
86
87
88
89
void DialogOk()
Definition dayztools.c:41
void RunDayZBat(string filepath, bool wait=false)
Definition dayztools.c:3
override void Configure()
Definition dayztools.c:35
override void Run()
Definition dayztools.c:80
string KillBatPath
Definition dayztools.c:78
override void Run()
Definition dayztools.c:55
string MissionBatPath
Definition dayztools.c:53
string KillBatPath
Definition dayztools.c:50
static proto void GetCwd(out string currentDir)
static proto int ScriptDialog(string caption, string text, Class data)
static proto native int RunCmd(string command, bool wait=false)
void WorkbenchPlugin()
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
string MissionBatPath
Definition dayztools.c:67
RestartDayzTool DayZTool WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})
Definition dayztools.c:62
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'.
proto native int IndexOfFrom(int start, string sample)
Finds 'sample' in 'str' from 'start' position.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto native int Length()
Returns length of string.