From b3e1b24ae635c1f57e16e69079463b6df61d7da9 Mon Sep 17 00:00:00 2001 From: Pierce Corcoran Date: Sun, 13 Jun 2021 00:24:19 -0700 Subject: [PATCH] Add support for commenting out events --- README.md | 4 ++-- SwiftSplit/CelesteSplitter.swift | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eda7a1e..7b8b16a 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,8 @@ single state change frequently causes multiple events, generally with differing Note that the *exact* text of an event is important. Spaces and capitalization have to match, with a couple additions: - Inserting an exclamation point (`!`) at the beginning of an event will cause that event to not trigger a split. This can be useful when your route passes between two screens multiple times but you only want one split. -- Anything after a ` ##` (*exactly* one space and two pound signs) will be trimmed off. This can be useful for - explaining events. +- Anything after `##` will be trimmed off. This can be useful for explaining events. +- Any event entries that start with `#` will be ignored, allowing you to "comment out" events. SwiftSplit has an "Event Stream" panel that displays events as they are triggered, which can be useful when creating route files. (You can copy the text out of the panel to paste directly into the route file too). diff --git a/SwiftSplit/CelesteSplitter.swift b/SwiftSplit/CelesteSplitter.swift index 8b9a3c1..7174a80 100644 --- a/SwiftSplit/CelesteSplitter.swift +++ b/SwiftSplit/CelesteSplitter.swift @@ -221,6 +221,9 @@ class RouteEvent { var event: String init?(from jsonString: String) { + if jsonString.prefix(1) == "#" { + return nil + } guard let match = RouteEvent.pattern.firstMatch(in: jsonString, options: [], range: NSRange(jsonString.startIndex..