-
Notifications
You must be signed in to change notification settings - Fork 468
Component NoteBlock
Florian Nücke edited this page Dec 7, 2013
·
6 revisions
This component represents a vanilla note block.
Component name: note_block.
Callbacks:
-
getPitch(): number
Gets the current pitch set on the note block. This will always be a number in the interval [1, 25]. -
setPitch(value: number): boolean
Sets the pitch for the note block. Must be a number in the interval [1, 25] or this will throw an error. Will returntrueon success. -
trigger([pitch: number]): boolean
Plays a note on the note block. If specified, sets the given pitch first, which must be in the interval [1, 25]. Returnstrueif a note was played, i.e. the block above the note block is an air block.
Example use:
val nb = component.note_block -- get primary note block
nb.setPitch(10)
nb.trigger()
for pitch = 1, 25 do
nb.trigger(pitch)
end