Posted 01 June 2012 - 03:45 PM
Hi!
This is a simple program i made to infinitely repeat music from a disk drive. It can detect when the disc is removed so to stop music, just take the disc out. I have not tested this on every single music disc, so the time until the song starts over may vary. Will adjust if needed.
Install:
1. Go to "%appdata%/.minecraft/mods/ComputerCraft/lua/programs"
2. Create a new file called "repeat" without any extensions
3. Open that file in Notepad or some other text editor
4. Copy-Paste the code to that file
5. Save and quit
Usage:
Just type in "repeat <side of disk drive>" to the computer console.
Please give feedback and suggestions if you want to.
This is a simple program i made to infinitely repeat music from a disk drive. It can detect when the disc is removed so to stop music, just take the disc out. I have not tested this on every single music disc, so the time until the song starts over may vary. Will adjust if needed.
Install:
1. Go to "%appdata%/.minecraft/mods/ComputerCraft/lua/programs"
2. Create a new file called "repeat" without any extensions
3. Open that file in Notepad or some other text editor
4. Copy-Paste the code to that file
5. Save and quit
Usage:
Just type in "repeat <side of disk drive>" to the computer console.
lengths = {["C418 - 13"]=180, ["C418 - cat"]=186, ["C418 - blocks"]=347, ["C418 - chirp"]=186, ["C418 - far"]=172, ["C418 - mall"]=197, ["C418 - mellohi"]=98, ["C418 - stal"]=151, ["C418 - strad"]=191, ["C418 - ward"]=250, ["C418 - 11"]=70}
args = { ... }
if #args == 0 then
print("Usage: repeat <side>")
return
end
command = args[1]
if disk.isPresent(command) then
if disk.hasAudio(command) then
while disk.isPresent(command) do
print("Playing ".. disk.getLabel(command))
disk.playAudio(command)
timesSlept = 0
length = lengths[disk.getLabel(command)]
while timesSlept <= length do
if disk.isPresent(command) == false then
print("Disk removed")
return
end
sleep(1)
timesSlept = timesSlept + 1
end
end
else
print("Disk in ".. command .. " drive is not an audio disk")
end
else
print("No disk in ".. command .. " drive")
end
Please give feedback and suggestions if you want to.