-
Notifications
You must be signed in to change notification settings - Fork 32
Beatmap Data
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.
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.
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(String difficultyName)
allows you to retrieve the Beatmap-object of a specific difficulty within the project's mapset. Using this will guarantee you are working in a certain Beatmap-object, independent of the one currently selected within the editor. For example:
var dummyMap = GetBeatmap("dummy");
var dummyBeatLength = dummyMap.GetTimingPointAt(0).BeatDuration;
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.
Need help with something that isn't in the wiki? Try contacting Damnae in osu! or Discord.