Skip to content

Instantly share code, notes, and snippets.

@Working-Joe
Forked from Dregu/Noita.asl
Last active November 23, 2023 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Working-Joe/affbd81409b094c9328ff1d20021ae77 to your computer and use it in GitHub Desktop.
Save Working-Joe/affbd81409b094c9328ff1d20021ae77 to your computer and use it in GitHub Desktop.
Noita Scriptable Auto Splitter for LiveSplit
/*
* Script adapted from https://gist.github.com/Dregu/f1b19e91989b93c908f2d2d642bf922c by Dregu
* to include splits at Holy Mountains.
*/
/*
* Noita Scriptable Auto Splitter + seed display + kill counter
* Starts on spawn
* Splits on work
* Resets on death or new game
*
* You have to edit the logPath below to point to your installation for this to actually work, I don't know where your game is.
* Get https://github.com/hawkerm/LiveSplit.ASLVarViewer to display world seed and/or kill counter to your stream, mom or whatever.
*/
state("noita") {
int foo: "noita.exe", 0; // stupid ASLVarViewer doesn't work without state variables
}
startup {
settings.Add("start", true, "Start");
settings.Add("spawn", true, "when player spawns", "start");
settings.Add("splits", true, "Split");
settings.Add("hm", true, "when you enter a holy mountain", "splits");
settings.Add("work", true, "when you complete the work", "splits");
settings.Add("reset", true, "Reset");
settings.Add("dead", true, "when dead", "reset");
settings.Add("newgame", true, "when starting game", "reset");
}
init {
// string logPath = "C:\\Steam\\steamapps\\common\\Noita\\logger.txt";
string logPath = "D:\\SteamLibrary\\steamapps\\common\\Noita\\logger.txt";
try {
FileStream fs = new FileStream(logPath, FileMode.Open, FileAccess.Write, FileShare.ReadWrite);
fs.SetLength(0);
fs.Close();
} catch {
print("Cant open log");
}
vars.isPaused = false;
vars.line = "";
vars.hm = 0;
vars.reader = new StreamReader(new FileStream(logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
if (vars.reader != null) print("opened log");
}
exit {
timer.IsGameTimePaused = true;
vars.reader = null;
}
update {
if (vars.reader == null) return false;
vars.line = vars.reader.ReadLine();
}
start {
if(vars.line != null && vars.line.StartsWith("SpawnPlayer")) {
vars.hm = 0;
timer.IsGameTimePaused = false;
vars.dead = false;
return true;
}
}
reset {
if(vars.line != null && vars.line.StartsWith("World seed:")) {
return settings["newgame"];
}
if(vars.line != null && vars.line.StartsWith("HandleEvent - Player Entity Destroyed")) {
return settings["dead"];
}
}
split {
if (vars.line != null && vars.line.StartsWith("LUA: Sampo:")) {
return (settings["work"]);
}
if(vars.line != null && vars.line.StartsWith("LUA: uusi HM ") && Int32.Parse(vars.line.Substring(13, 1)) > vars.hm) {
vars.hm = Int32.Parse(vars.line.Substring(13, 1));
return (settings["hm"]);
}
}
isLoading {
}
@PastPan
Copy link

PastPan commented Nov 23, 2023

it can't work beacues of the update in 2023, will you update this auto splitter in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment