Skip to content
loverthehater edited this page Jun 18, 2017 · 9 revisions

Information about beatmaps can be retrieved by scripts through the Beatmap property.

The beatmap used by scripts has its name displayed in the timeline, you can switch to another beatmap by right clicking the timeline.

HitObjects

You can retrieve information common to all types of objects through the Beatmap's HitObjects property.

foreach (var hitobject in Beatmap.HitObjects)
{
    var sprite = layer.CreateSprite("sb/pl.png");
    sprite.Fade(hitobject.StartTime, hitobject.EndTime + 200, 1, 0);
    sprite.Move(hitobject.StartTime, hitobject.EndTime, hitobject.Position, hitobject.EndPosition);
}

Hitobjects can be an OsuCircle, OsuSlider, OsuSpinner or OsuHold. Here's an example of how to retrieve information that only certain type of objects have, like a slider's length:

var slider = hitobject as OsuSlider;
if (slider != null)
{
    var sliderLength = slider.Length;
    // etc.
}

You can find an example of using this to highlight hitobjects in scripts/HitObjectHighlight.cs.

Timing and Control Points

All timing points (red lines only) can be retrieved through the Beatmap's TimingPoints property. You can also use GetTimingPointAt(time) to retrieve the timing point used at a certain time.

The ControlPoints property and the GetControlPointAt(time) are the same, but return both red and green lines.

GetBeatmap

GetBeatmap(DifficultyName) allows you to retrieve information from a specific beatmap within the current mapset.

Setting the GetBeatmap(DifficultyName) function to a variable will allow that variable to act exactly like the Beatmap function except it will retrieve information from DifficultyName regardless of the current beatmap selected in Storybrew. For example:

var dummyMap = GetBeatmap("dummy");
var dummyBeatLength = dummyMap.GetTimingPointAt(0).BeatDuration;

Other Properties

The Bookmarks property will list the times of all bookmarks.

A list of all beatmap properties available can be found while you type Beatmap. in your script.

Clone this wiki locally