Skip to content

Commit

Permalink
Add support for commenting out events
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodewarrior committed Jun 13, 2021
1 parent 1557bfb commit b3e1b24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 3 additions & 0 deletions SwiftSplit/CelesteSplitter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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..<jsonString.endIndex, in: jsonString)) else {
return nil
}
Expand Down

0 comments on commit b3e1b24

Please sign in to comment.