diff options
Diffstat (limited to 'Manifold Garden.asl')
-rw-r--r-- | Manifold Garden.asl | 100 |
1 files changed, 79 insertions, 21 deletions
diff --git a/Manifold Garden.asl b/Manifold Garden.asl index 71cb203..c076972 100644 --- a/Manifold Garden.asl +++ b/Manifold Garden.asl | |||
@@ -1,6 +1,6 @@ | |||
1 | // AutoSplit script for Manifold Garden | 1 | // AutoSplit script for Manifold Garden |
2 | // | 2 | // |
3 | // Written by hatkirby, with help from preshing and Gelly. | 3 | // Written by hatkirby, with help from preshing, Gelly, and darkid. |
4 | // | 4 | // |
5 | // Automatically starts the timer when a new game is started. You must still | 5 | // Automatically starts the timer when a new game is started. You must still |
6 | // reset the timer manually between runs. | 6 | // reset the timer manually between runs. |
@@ -8,9 +8,17 @@ | |||
8 | // A split is also triggered after being in one of the ending cutscenes for 1.1 | 8 | // A split is also triggered after being in one of the ending cutscenes for 1.1 |
9 | // seconds, since this is when the kaleidoscope appears. | 9 | // seconds, since this is when the kaleidoscope appears. |
10 | // | 10 | // |
11 | // If you check "All God Cubes waypoints" in the script's Advanced settings | 11 | // The following options are mutually exclusive: |
12 | // (below), the script will only split at mandala scenes. This is useful when | 12 | // - Split on every level change |
13 | // running "All God Cubes" categories. | 13 | // - All God Cubes waypoints |
14 | // - Zero% waypoints | ||
15 | // - Split based on a configuration file | ||
16 | // | ||
17 | // If you want to customize which levels the autosplitter splits at, create a | ||
18 | // file with a .mg_config extension and put it in the same directory as your | ||
19 | // splits. This file should contain a list of level names, one per line. These | ||
20 | // level names must exactly match the names shown in-game using the | ||
21 | // toggle_beta_message feature. | ||
14 | // | 22 | // |
15 | // This should be mostly version-independent, but it works best on 1.0.0.14704 | 23 | // This should be mostly version-independent, but it works best on 1.0.0.14704 |
16 | // (Steam "Speedrunning Branch"). | 24 | // (Steam "Speedrunning Branch"). |
@@ -26,12 +34,12 @@ startup { | |||
26 | vars.Helper = Activator.CreateInstance(type, timer, this); | 34 | vars.Helper = Activator.CreateInstance(type, timer, this); |
27 | vars.Helper.LoadSceneManager = true; | 35 | vars.Helper.LoadSceneManager = true; |
28 | 36 | ||
37 | settings.Add("raymarchitecture", true, "Split on Raymarchitecture (ending cutscene)"); | ||
38 | settings.Add("norepeats",false,"Split only on the first encounter of each level"); | ||
29 | settings.Add("every",true,"Split on every level change"); | 39 | settings.Add("every",true,"Split on every level change"); |
30 | settings.Add("fall",false,"Including all ending falling scenes","every"); | 40 | settings.Add("fall",false,"Including all ending falling scenes","every"); |
31 | settings.Add("allGodCubes", false, "All God Cubes waypoints"); | 41 | settings.Add("allGodCubes", false, "All God Cubes waypoints"); |
32 | settings.Add("zero", false, "Zero% waypoints"); | 42 | settings.Add("zero", false, "Zero% waypoints"); |
33 | settings.Add("raymarchitecture", true, "Split on Raymarchitecture (ending cutscene)"); | ||
34 | settings.Add("norepeats",false,"Split only on the first encounter of each level"); | ||
35 | 43 | ||
36 | vars.waypoints = null; | 44 | vars.waypoints = null; |
37 | vars.prevLevel = 0; | 45 | vars.prevLevel = 0; |
@@ -91,6 +99,39 @@ startup { | |||
91 | "World_804_Optimized", | 99 | "World_804_Optimized", |
92 | "World_071_AkshardhamTemple_Optimized" | 100 | "World_071_AkshardhamTemple_Optimized" |
93 | }; | 101 | }; |
102 | |||
103 | vars.configFiles = null; | ||
104 | vars.settings = settings; | ||
105 | var findConfigFiles = (Action<string>)((string folder) => { | ||
106 | var files = new List<string>(); | ||
107 | if (folder != null) { | ||
108 | print("Searching for config files in '" + folder + "'"); | ||
109 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_config")); | ||
110 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_config.txt")); | ||
111 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_conf")); | ||
112 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_confi")); | ||
113 | print("Found " + files.Count + " config files"); | ||
114 | } | ||
115 | |||
116 | // Only add the parent setting the first time we call this function | ||
117 | if (vars.configFiles == null) { | ||
118 | vars.configFiles = new Dictionary<string, string>(); | ||
119 | vars.settings.Add("configs", (files.Count > 0), "Split based on configuration file:"); | ||
120 | } | ||
121 | |||
122 | foreach (var file in files) { | ||
123 | string fileName = file.Split('\\').Last(); | ||
124 | if (vars.configFiles.ContainsKey(fileName)) continue; | ||
125 | vars.configFiles[fileName] = file; | ||
126 | vars.settings.Add(fileName, false, null, "configs"); | ||
127 | } | ||
128 | }); | ||
129 | // Search for config files relative to LiveSplit.exe | ||
130 | findConfigFiles(Directory.GetCurrentDirectory()); | ||
131 | // Search for config files relative to the current layout | ||
132 | findConfigFiles(System.IO.Path.GetDirectoryName(timer.Layout.FilePath)); | ||
133 | // Search for config files relative to the current splits | ||
134 | findConfigFiles(System.IO.Path.GetDirectoryName(timer.Run.FilePath)); | ||
94 | } | 135 | } |
95 | 136 | ||
96 | init { | 137 | init { |
@@ -110,6 +151,20 @@ init { | |||
110 | }); | 151 | }); |
111 | 152 | ||
112 | vars.Helper.Load(); | 153 | vars.Helper.Load(); |
154 | |||
155 | vars.configWaypoints = null; | ||
156 | if (settings["configs"]) { | ||
157 | string[] lines = {""}; | ||
158 | foreach (var configFile in vars.configFiles.Keys) { | ||
159 | if (settings[configFile]) { | ||
160 | // Full path is saved in the dictionary. | ||
161 | vars.configWaypoints = System.IO.File.ReadAllLines(vars.configFiles[configFile]); | ||
162 | print("Selected config file: " + configFile); | ||
163 | print("Config contains " + vars.configWaypoints.Length + " lines"); | ||
164 | break; | ||
165 | } | ||
166 | } | ||
167 | } | ||
113 | } | 168 | } |
114 | 169 | ||
115 | update { | 170 | update { |
@@ -153,22 +208,25 @@ start { | |||
153 | // moment you click a save slot to start a new game in, although it will | 208 | // moment you click a save slot to start a new game in, although it will |
154 | // also start if you just load a file). This boolean is set to true during | 209 | // also start if you just load a file). This boolean is set to true during |
155 | // the studio logo when the game starts up, so we check for that as well. | 210 | // the studio logo when the game starts up, so we check for that as well. |
156 | if (vars.studioScreenDone && current.isLoadingGameFromUI) { | 211 | return (vars.studioScreenDone && current.isLoadingGameFromUI); |
157 | print(String.Format("Level changed from {0} to {1}: START", old.level, current.level)); | 212 | } |
158 | if (settings["zero"]) { | 213 | |
159 | vars.waypoints = vars.zeroPercentPoints; | 214 | onStart { |
160 | } else if (settings["allGodCubes"]) { | 215 | print("START based on file load"); |
161 | vars.waypoints = vars.mandalaScenes; | 216 | if (settings["zero"]) { |
162 | } else { | 217 | vars.waypoints = vars.zeroPercentPoints; |
163 | vars.waypoints = null; | 218 | } else if (settings["allGodCubes"]) { |
164 | } | 219 | vars.waypoints = vars.mandalaScenes; |
165 | vars.prevLevel = current.level; | 220 | } else if (settings["configs"] && vars.configWaypoints != null) { |
166 | vars.stopwatch = Stopwatch.StartNew(); | 221 | vars.waypoints = new List<string>(vars.configWaypoints); |
167 | vars.prev.Clear(); | 222 | } else { |
168 | vars.firstRoom = false; | 223 | vars.waypoints = null; |
169 | vars.inEnding = false; | ||
170 | return true; | ||
171 | } | 224 | } |
225 | vars.prevLevel = current.level; | ||
226 | vars.stopwatch = Stopwatch.StartNew(); | ||
227 | vars.prev.Clear(); | ||
228 | vars.firstRoom = false; | ||
229 | vars.inEnding = false; | ||
172 | } | 230 | } |
173 | 231 | ||
174 | split { | 232 | split { |