Skip to content

note[i]

Every note on its way to you, one by one. Make them ride in on a wave, fade as they come closer, spin, grow - the wildest modchart effects live here.

Written in .modchart files

These properties move the lanes and notes, so only a .modchart file may set them (any file may read them; strums.input, the keys on / off, may be set anywhere). A .event that sets one doesn't load. The No Mod modifier leaves .modchart files out. Two kinds of file.

How to use it

Every frame the game lists the notes of your lanes that are on the screen (or about to be), in the order they come: note[0] is the next, up to note[notes.count - 1] (at most 128). Read lane, time, distance, ...; write x, y, alpha, angle, scale, visible.

Your values last one frame: before every frame the game puts all notes back. Write them every frame in onFrame. A tween on a note[i] is an error when the file loads, for the same reason.

The list only exists while a script of the song uses note[...] - songs without cost nothing.

Psych: getPropertyFromGroup('notes', i, ...), notes.length · Kade: notes in update

Example code

-- Swaying notes: each sways sideways by its distance, and fades in late.
function onFrame(dt)
    for i = 0, notes.count - 1 do
        note[i].x = 30 * sin(note[i].distance / 200 + note[i].lane)
        note[i].alpha = clamp(1 - (note[i].distance - 400) / 600, 0, 1)
    end
end

Properties

Property Kind Default
notes.count number, read 0 How many notes are listed this frame.
note[i].lane number, read 0 Its lane: 0-3 (left, down, up, right).
note[i].time number, read 0 When it's to be hit, in song ms.
note[i].beat number, read 0 The beat the note is on (beats follow the chart's tempo changes). Kade's note.beat.
note[i].distance number, read 0 Ms until then - below 0 for a hold being played.
note[i].hold number, read 0 A hold's length in ms (0 = a tap).
note[i].held switch, read false Whether it's a hold the player is holding right now.
note[i].trap switch, read false Whether it's a Forced-Miss Note.
note[i].id number, read -1 The note's number in the chart: the same note keeps it from frame to frame, while its …
note[i].x number 0 Moved to the right in pixels, with its hold.
note[i].y number 0 Moved down in pixels, with its hold.
note[i].alpha number 1 Its opacity.
note[i].angle number 0 Turned clockwise, in degrees.
note[i].scale number 1 Its size.
note[i].visible switch true false = not drawn. It can still be hit.

notes.count

number notes.count = 0

read only

How many notes are listed this frame.

note[i].lane

number note[i].lane = 0

read only

Its lane: 0-3 (left, down, up, right).

note[i].time

number note[i].time = 0

read onlyms

When it's to be hit, in song ms.

note[i].beat

number note[i].beat = 0

read only

The beat the note is on (beats follow the chart's tempo changes). Kade's note.beat.

note[i].distance

number note[i].distance = 0

read onlyms

Ms until then - below 0 for a hold being played.

note[i].hold

number note[i].hold = 0

read onlyms

A hold's length in ms (0 = a tap).

note[i].held

switch note[i].held = false

read only

Whether it's a hold the player is holding right now.

note[i].trap

switch note[i].trap = false

read only

Whether it's a Forced-Miss Note.

note[i].id

number note[i].id = -1

read only

The note's number in the chart: the same note keeps it from frame to frame, while its place in the list moves on. -1 = no note in this slot. noteSlot(id) finds where it is listed now.

-- Remember the next note and keep turning it, wherever it is in the list.
local spinning = -1
function onBeat(b)
    if notes.count > 0 then spinning = note[0].id end
end
function onFrame(dt)
    local i = noteSlot(spinning)
    if i >= 0 then note[i].angle = time / 2 end
end

note[i].x

number note[i].x = 0

kept at the song's end.modchart only

Moved to the right in pixels, with its hold.

note[i].y

number note[i].y = 0

kept at the song's end.modchart only

Moved down in pixels, with its hold.

note[i].alpha

number note[i].alpha = 1

0 – 1share of the screenkept at the song's end.modchart only

Its opacity.

note[i].angle

number note[i].angle = 0

degreeskept at the song's end.modchart only

Turned clockwise, in degrees.

note[i].scale

number note[i].scale = 1

kept at the song's end.modchart only

Its size.

note[i].visible

switch note[i].visible = true

kept at the song's end.modchart only

false = not drawn. It can still be hit.