mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 02:56:53 -04:00
6
Component NoteBlock
Vexatos edited this page 2014-07-13 05:31:20 -07:00
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