Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script created by Frekvens1 --
- -- OpenComputers --
- -- Components required: Computer Case, Redstone I/O, Adapter, Note Block, button --
- -- Run script on PC, and give the redstone I/O a redstone signal! --
- -- Remember to put the note block next to the adapter --
- -- If downloaded from pastebin, internet card too --
- -- pastebin get WYjyceBK zelda.lua
- local component = require("component")
- local sides = require("sides")
- local term = require("term")
- local rs = component.redstone
- local nb = component.note_block
- local t = 0.2 -- Delay between each note
- local check_for_redstone_all_sides = true -- Set to true if only one side of the redstone I/O block should activate the song
- local rs_Side = sides.front
- local zelda_Song = {13,12, 9, 3, 2,10,14,18}
- local zelda_Wait = { t, t, t, t, t, t, t}
- function sleep(duration)
- os.sleep(tonumber(duration))
- end
- function playNote(note, sleep_duration)
- nb.trigger(tonumber(note))
- sleep(sleep_duration)
- end
- function playZelda()
- term.clear()
- print("Now playing:")
- print("The Legend of Zelda, unlocked secret")
- for i, note in ipairs(zelda_Song) do
- playNote(note, zelda_Wait[i])
- end
- term.clear()
- end
- while true do
- if (check_for_redstone_all_sides) then
- local r_s = rs.getInput
- if (r_s(sides.bottom) > 0) then
- playZelda()
- elseif (r_s(sides.top) > 0) then
- playZelda()
- elseif (r_s(sides.back) > 0) then
- playZelda()
- elseif (r_s(sides.front) > 0) then
- playZelda()
- elseif (r_s(sides.right) > 0) then
- playZelda()
- elseif (r_s(sides.left) > 0) then
- playZelda()
- else
- os.sleep(0.1)
- end
- else
- local rs_Input = rs.getInput(rs_Side)
- if (rs_Input > 0) then
- playZelda()
- else
- os.sleep(0.1)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement