Skip to content

Commit b3e1b24

Browse files
Add support for commenting out events
1 parent 1557bfb commit b3e1b24

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ single state change frequently causes multiple events, generally with differing
8787
Note that the *exact* text of an event is important. Spaces and capitalization have to match, with a couple additions:
8888
- Inserting an exclamation point (`!`) at the beginning of an event will cause that event to not trigger a split. This
8989
can be useful when your route passes between two screens multiple times but you only want one split.
90-
- Anything after a ` ##` (*exactly* one space and two pound signs) will be trimmed off. This can be useful for
91-
explaining events.
90+
- Anything after `##` will be trimmed off. This can be useful for explaining events.
91+
- Any event entries that start with `#` will be ignored, allowing you to "comment out" events.
9292

9393
SwiftSplit has an "Event Stream" panel that displays events as they are triggered, which can be useful when creating
9494
route files. (You can copy the text out of the panel to paste directly into the route file too).

SwiftSplit/CelesteSplitter.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ class RouteEvent {
221221
var event: String
222222

223223
init?(from jsonString: String) {
224+
if jsonString.prefix(1) == "#" {
225+
return nil
226+
}
224227
guard let match = RouteEvent.pattern.firstMatch(in: jsonString, options: [], range: NSRange(jsonString.startIndex..<jsonString.endIndex, in: jsonString)) else {
225228
return nil
226229
}

0 commit comments

Comments
 (0)