Skip to content

Custom events

Artemis Kearney edited this page Jun 5, 2019 · 5 revisions

In addition to providing access to the custom data found in info.dat, CustomJSONData.CustomBeatmap.CustomBeatmapData provides a new dictionary of lists of CustomEventData objects. Not to be confused with CustomBeatmapEventDatas, which are Beat Saber lighting events with custom data added, this is a place for entirely new events added to the game by plugins. These events are stored in difficulty .dat files. Here's an example of what a custom event might look like inside a difficulty:

"_version":"2.0.0",
"_customEvents":[
    {
        "_time":0.0,
        "_type":"HelloWorld",
        "_data":{
            "foo":1.0,
            "message":"Hello from a custom event!"
        }
    }
],
"_events":[
// ...

CustomJSONData itself includes no facility for broadcasting custom events. However, SimpleCustomEvents has been created for this purpose. (The repository name is "SimpleCustomEvents" because a more fully-featured CustomEvents plugin is in the works. An attempt will be made to preserve backwards compatibility, but no promises.) There's nothing to stop you processing them yourself, but if all you want is to subscribe to custom events, you probably shouldn't bother.

A CustomEventData object has three fields.

  • time functions identically to the time field on notes/obstacles/lighting events.
  • type, unlike in lighting events, is a string; use it to specify what sort of event this is. Event types are de-facto defined/standardized by the first plugin to make use of them.
  • data is a Tree (custom data object) as discussed elsewhere in this wiki.

CustomBeatmapData provides access to CustomEventDatas as a dictionary of lists, keyed on event type.

Clone this wiki locally