Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Made By HDR - @MartinRefseth #--
- --# Version 2.3 #--
- --# Thanks to Lyqyd for his Button API http://www.computercraft.info/forums2/index.php?/topic/14784-touchpoint-api/ #--
- os.loadAPI("touchpoint")
- for a,b in pairs(rs.getSides()) do
- if peripheral.getType(b) == 'monitor' then
- mon = peripheral.wrap(b)
- t = touchpoint.new(b)
- break
- end
- end
- --# Functions
- function play()
- peripheral.find("drive", disk.stopAudio)
- peripheral.find( "drive", function( name )
- if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
- print("Now Playing"," ",( title) )
- disk.playAudio( name )
- end
- end )
- end
- function Thir()
- t:flash("13")
- title = "C418 - 13"
- play()
- end
- function Cat()
- t:flash("Cat")
- title = "C418 - cat"
- play()
- end
- function Blocks()
- t:flash("Blocks")
- title = "C418 - blocks"
- play()
- end
- function Chirp()
- t:flash("Chirp")
- title = "C418 - chirp"
- play()
- end
- function Far()
- t:flash("Far")
- title = "C418 - far"
- play()
- end
- function Mall()
- t:flash("Mall")
- title = "C418 - mall"
- play()
- end
- function Mellohi()
- t:flash("Mellohi")
- title = "C418 - mellohi"
- play()
- end
- function Stal()
- t:flash("Stal")
- title = "C418 - stal"
- play()
- end
- function Strad()
- t:flash("Strad")
- title = "C418 - strad"
- play()
- end
- function Ward()
- t:flash("Ward")
- title = "C418 - ward"
- play()
- end
- function Elev()
- t:flash("11")
- title = "C418 - 11"
- play()
- end
- function Wait()
- t:flash("Wait")
- title = "C418 - wait"
- play()
- end
- --#Stops All Music
- function Stop()
- t:flash("Stop")
- print("Stopping Disk")
- peripheral.find("drive", disk.stopAudio)
- end
- function Reboot()
- t:flash("Reboot")
- print("Rebooting")
- peripheral.find("drive", disk.stopAudio)
- mon.clear()
- os.reboot()
- end
- -- A list of all possible songs --# Thanks to http://pastebin.com/u/MechWipf for the Random function #--
- local Songs = {
- Thir, Cat, Blocks, Chirp, Far, Mall, Mellohi, Stal, Strad, Ward,
- Elev, Wait, Question, GaiaOne, GaiaTwo, Roop, Slive, WYG, Wander
- }
- function Random()
- t:flash("Random")
- peripheral.find("drive", disk.stopAudio)
- local maxSongs = #Songs -- the "#" gets the length of the list
- local randomNumber = math.random( maxSongs )
- Songs[randomNumber]() -- call the choosen song directly out of the list
- end
- --#OverWrites Part Of Touchpoint API#--
- t.draw = function(self)
- local function cT(text)
- x,y = term.getSize()
- x1,y1 = term.getCursorPos()
- term.setCursorPos((math.floor(x/2) - (math.floor(#text/2))), y1)
- term.write(text)
- end
- local old = term.redirect(self.mon)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.orange)
- cT("HDR's Music System V2.3")
- for name, buttonData in pairs(self.buttonList) do
- if buttonData.active then
- term.setBackgroundColor(buttonData.activeColor)
- term.setTextColor(buttonData.activeText)
- else
- term.setBackgroundColor(buttonData.inactiveColor)
- term.setTextColor(buttonData.inactiveText)
- end
- for i = buttonData.yMin, buttonData.yMax do
- term.setCursorPos(buttonData.xMin, i)
- term.write(buttonData.label[i - buttonData.yMin + 1])
- end
- end
- if old then
- term.redirect(old)
- else
- term.restore()
- end
- end
- --# Buttons
- t:add("13", Thir, 3,3,13,5, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Cat", Cat, 15,3,25,5, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Blocks", Blocks, 27,3,37,5, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Chirp", Chirp, 3,7,13,9, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Far", Far, 15,7,25,9, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Mall", Mall, 27,7,37,9, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Mellohi", Mellohi, 3,11,13,13, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Stal", Stal, 15,11,25,13, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Strad", Strad, 27,11,37,13, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Ward", Ward, 3,15,13,17, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("11", Elev, 15,15,25,17, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Wait", Wait, 27,15,37,17, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Random", Random, 3,19,13,19, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Stop", Stop, 15,19,25,19, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:add("Reboot", Reboot, 27,19,37,19, colors.cyan, colors.lime, colors.orange, colors.orange)
- t:run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement