DayZ 1.24
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;
13 filepath = cwd + "/" + filepath;
14 }
15
16 int index = filepath.IndexOf("/");
17 int last_index = index;
18
19 while (index != -1)
20 {
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 {
57 RunDayZBat(KillBatPath, true);
58 RunDayZBat(MissionBatPath);
59 }
60}
61
62[WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})]
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 {
82 RunDayZBat(KillBatPath);
83 }
84}
85
string MissionBatPath
Definition DayZTools.c:67
RestartDayzTool DayZTool WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})
Definition DayZTools.c:62
override void Run()
Definition DayZTools.c:69
string KillBatPath
Definition DayZTools.c:64
void RunDayZBat(string filepath, bool wait=false)
Definition DayZTools.c:3
override void Configure()
Definition DayZTools.c:35
void DialogOk()
Definition DayZTools.c:41
string KillBatPath
Definition DayZTools.c:78
override void Run()
Definition DayZTools.c:80
string KillBatPath
Definition DayZTools.c:50
override void Run()
Definition DayZTools.c:55
string MissionBatPath
Definition DayZTools.c:53
static proto native int RunCmd(string command, bool wait=false)
static proto void GetCwd(out string currentDir)
static proto int ScriptDialog(string caption, string text, Class data)