-
Notifications
You must be signed in to change notification settings - Fork 432
Component NoteBlock
Vexatos edited this page Jul 13, 2014
·
6 revisions
For those that don't like images: the wiki has moved to a new place, http://ocdoc.cil.li/.
This wiki will no longer be updated.
This component represents a vanilla note block.
Important: this component is only available if OpenComponents is also installed!
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 returntrue
on 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]. Returnstrue
if a note was played, i.e. the block above the note block is an air block.
Example use:
local component = require("component")
local nb = component.note_block -- get primary note block
nb.setPitch(10)
nb.trigger()
for pitch = 1, 25 do
nb.trigger(pitch)
end