Every fluXis Lua script — regardless of whether it is a storyboard script or a skin script — has access to a common set of global functions and objects injected by the baseDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/InventiveRhythm/fluXis/llms.txt
Use this file to discover all available pages before exploring further.
ScriptRunner class. These cover versioning, randomness, BPM queries, parameter declarations, logging, math, vector and colour construction, easing lookup, and (in storyboard context) full audio frequency analysis. This page documents all of them with examples and parameter details.
Core Global Functions
SetVersion(v)
Declares which version of the storyboard API the script was written against. Must be called at the very top of the script before any other code.
Target API version. The current latest version is 2.
RandomRange(from, to)
Returns a uniformly distributed random integer between from and to inclusive. The underlying implementation uses osu!framework’s RNG.Next, which is seeded per-run.
Lower bound (inclusive).
Upper bound (inclusive).
BPMAtTime(time)
Returns the BPM value of the timing point active at the given map timestamp.
Map time in milliseconds.
BPMAtTime reads from the map’s timing points table. Calling it without a loaded map (outside of gameplay context) will throw an error.DefineParameter(key, title, type, fallback)
Registers a user-editable parameter that the storyboard editor can expose in its UI panel. Users set values in the editor; scripts read them back on an element via element:param(key, fallback).
Unique identifier for this parameter. Used as the lookup key in
:param().Human-readable label shown in the editor UI.
Data type of the parameter. Must be one of:
"string", "int", "float", "boolean".Default value used when the parameter has not been set. Optional.
print(text)
Writes a message to the fluXis scripting log (scripting.log). Useful for debugging during development; has no effect on gameplay rendering.
Message to log. The engine prepends
[Script] to each entry.Constructors
Vector2(x, y)
Creates a new 2D vector object. All position and size fields that take vectors expect a Vector2 instance.
Horizontal component.
Vertical component.
Convenience Constructors
| Function | Equivalent |
|---|---|
Vector2Zero() | Vector2(0, 0) |
Vector2One() | Vector2(1, 1) |
Color4(r, g, b, a)
Creates a colour value with components in the range 0.0 – 1.0.
Red channel (0.0 – 1.0).
Green channel (0.0 – 1.0).
Blue channel (0.0 – 1.0).
Alpha channel (0.0 – 1.0).
Easing(str)
Converts an easing name string to its internal numeric value. Pass the result directly to element:animate().
Name of the easing curve. Returns
Easing.None (0) for unrecognised strings.All Easing Values
All Easing Values
| Name | Curve Behaviour |
|---|---|
"None" | Linear / no easing |
"Out" | Generic ease-out |
"In" | Generic ease-in |
"InQuad" | Quadratic in |
"OutQuad" | Quadratic out |
"InOutQuad" | Quadratic in-out |
"InCubic" | Cubic in |
"OutCubic" | Cubic out |
"InOutCubic" | Cubic in-out |
"InQuart" | Quartic in |
"OutQuart" | Quartic out |
"InOutQuart" | Quartic in-out |
"InQuint" | Quintic in |
"OutQuint" | Quintic out |
"InOutQuint" | Quintic in-out |
"InSine" | Sinusoidal in |
"OutSine" | Sinusoidal out |
"InOutSine" | Sinusoidal in-out |
"InExpo" | Exponential in |
"OutExpo" | Exponential out |
"InOutExpo" | Exponential in-out |
"InCirc" | Circular in |
"OutCirc" | Circular out |
"InOutCirc" | Circular in-out |
"InElastic" | Elastic in (overshoot) |
"OutElastic" | Elastic out |
"OutElasticHalf" | Elastic out, half amplitude |
"OutElasticQuarter" | Elastic out, quarter amplitude |
"InOutElastic" | Elastic in-out |
"InBack" | Back in (slight pullback) |
"OutBack" | Back out (slight overshoot) |
"InOutBack" | Back in-out |
"InBounce" | Bounce in |
"OutBounce" | Bounce out |
"InOutBounce" | Bounce in-out |
"OutPow10" | Power-10 ease-out (very snappy) |
mathf — Math Utilities
The mathf global is an instance of LuaMath. It exposes every operation you would expect from a game math library, including constants, scalar functions, trigonometry, and a full suite of 2D vector operations.
Constants
| Field | Value |
|---|---|
mathf.pi | π ≈ 3.14159… |
mathf.tau | τ = 2π ≈ 6.28318… |
mathf.e | Euler’s number ≈ 2.71828… |
Scalar Functions
- Basic
- Trigonometry
- Vector2 Ops
| Function | Description |
|---|---|
mathf:abs(d) | Absolute value |
mathf:clamp(value, min, max) | Clamps value between min and max |
mathf:min(a, b) | Smaller of two values |
mathf:max(a, b) | Larger of two values |
mathf:sign(d) | -1 / 0 / 1 depending on sign |
mathf:floor(d) | Floor to integer |
mathf:floort(d, threshold) | Floor only if d >= threshold, else return d unchanged |
mathf:ceil(d) | Ceiling to integer |
mathf:ceilt(d, threshold) | Ceiling only if d <= threshold, else return d unchanged |
mathf:round(d) | Round to nearest integer |
mathf:roundt(d, threshold) | Round only if within threshold of a whole number |
mathf:sqrt(d) | Square root |
mathf:pow(x, y) | x raised to the power y |
mathf:exp(d) | e raised to d |
mathf:log(d) | Natural logarithm (base e) |
mathf:log10(d) | Base-10 logarithm |
mathf:lerp(a, b, t) | Linear interpolation: a + (b-a)*t |
FFTParameters — Audio Analysis Presets
FFTParameters is a global object that holds three pre-configured parameter sets for audio frequency analysis. Pass one of these to AudioAnalyzer:AmplitudesInRange() as the optional fifth argument.
| Preset | Description |
|---|---|
FFTParameters.Default | Balanced settings suitable for most maps |
FFTParameters.Reactive | High attack and fast decay — snappy, closely follows transients |
FFTParameters.Smooth | Slower attack and gentler decay — good for ambient or sustained effects |
FFTParameters table by setting individual fields. All fields are numbers unless noted:
All FFTParameters Fields
All FFTParameters Fields
How fast amplitude values rise. High values (e.g. 0.95) are instant; low values (e.g. 0.50) look slightly delayed.
How fast the bass band falls after a peak. Low values (0.05) cause slow decay; high values (0.40) make kicks end sharply.
How fast the treble band falls. High values can cause jitter on cymbals.
Contrast exponent applied to final amplitudes (
value^gamma). Values below 1 boost quiet noise; values above 2 isolate only loud peaks.Number of adjacent bins to average. Value of 1 means no smoothing; values above 5 produce a smooth curve.
Frequency spectrum position [0–1] where bass ends and mid begins.
Frequency spectrum position [0–1] where mid ends and high begins.
Boost/attenuate the bass band. Values above 1.0 intensify kick and bass; below 1.0 reduce them.
Boost/attenuate the mid band (vocals, synths, guitars).
Boost/attenuate the high band (hi-hats, cymbals, treble).
Minimum peak volume for bass before auto-normalisation kicks in.
Minimum peak volume for mid before auto-normalisation kicks in.
Minimum peak volume for high before auto-normalisation kicks in.
How fast dynamic auto-levelling adapts to the current volume. Low values preserve loudness contrast; high values keep output consistent.
AudioAnalyzer — Frequency Analysis
The AudioAnalyzer global (available in storyboard scripts) provides pre-computed FFT data for the entire map audio track. Because storyboard scripts run once before gameplay starts, all audio data is available up front for the full map duration.
AudioAnalyzer:AmplitudesInRange(startTime, endTime, interval, amplitudeCount, parameters)
Returns a Lua table of FFTFrame objects, one per interval step between startTime and endTime.
Start of the time range in milliseconds.
End of the time range in milliseconds.
How many milliseconds apart each sample is. For example
16 gives ~60 fps resolution.Number of frequency bins per frame. Defaults to the engine’s FFT bin count. Fewer bins are faster and produce a coarser spectrum.
Optional FFT processing parameters. Defaults to
FFTParameters.Default when omitted.FFTFrame Fields and Methods
Each entry in the returned table is an FFTFrame:
Array of amplitude values, one per frequency bin. Index 1 = bass, last index = treble.
Frequency band summary object with
.low, .mid, .high, and .total fields (all numbers, 0–1).| Method | Returns | Description |
|---|---|---|
frame:IsSilent(threshold) | boolean | True if all amplitudes are below threshold |
frame:DetectBeat(threshold) | boolean | True if the frame’s energy exceeds threshold — useful for beat detection |
frame:GetPeakAmplitude() | number | Highest amplitude value across all bins |
frame:GetAverageAmplitude() | number | Mean amplitude across all bins |
frame:GetPeakFrequencyBin() | number | Index of the bin with the highest amplitude |
FFTBands:GetDominantBand() returns the numeric index (0=low, 1=mid, 2=high) of whichever band has the most energy.
map — Map Data Access
The map global is available in storyboard scripts and exposes five query methods. All return a Lua table (array) of the matching objects.
All hit objects between
startTime and endTime. Optional type filters by "Normal", "Tick", or "Landmine". Note that "Normal" also returns long notes.All timing points active in the range. Each has
.time, .bpm, .signature, and .hideLines.All scroll velocity changes in the range. Each has
.time, .multiplier, .group, .groups, and .laneMask.All hit-sound volume fade events in the range.
All storyboard events of the given
EventType string in the range.HitObject Fields
| Field | Type | Description |
|---|---|---|
time | number | Hit time in milliseconds |
lane | number | Column index (1-based) |
visualLane | number | Visual lane (tick notes only) |
holdTime | number | Long note duration in ms (0 for normal notes) |
hitSound | string | Name of the assigned hit sound |
group | string | Group tag |
hidden | boolean | Whether the note is hidden |
type | number | Numeric hit object type |
