Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Made By HDR - @MartinRefseth #--
- os.loadAPI("touchpoint")
- for a,b in pairs(rs.getSides()) do
- if peripheral.getType(b) == 'monitor' then
- home = touchpoint.new(b)
- settings = touchpoint.new(b)
- buttonColor = touchpoint.new(b)
- textColor = touchpoint.new(b)
- backgroundColor = touchpoint.new(b)
- local t
- break
- end
- end
- if fs.exists("musicsystem.cfg") == false then
- local ColorTable = {ButtonColor = "512", TextColor = "2", BackgroundColor = "128"}
- writeCFG = fs.open("musicsystem.cfg", "w")
- writeCFG.write( textutils.serialize( ColorTable ) )
- writeCFG.close()
- end
- openCFG = fs.open( "musicsystem.cfg", "r" )
- data = openCFG.readAll()
- openCFG.close()
- CFGData = textutils.unserialize(data)
- mainCol = tonumber(CFGData.ButtonColor)
- textCol = tonumber(CFGData.TextColor)
- backCol = tonumber(CFGData.BackgroundColor)
- --# Functions
- function tpoint()
- t = tpage
- --#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(backCol)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(textCol)
- cT(header)
- 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
- end
- function colWrite()
- local ColorTable = {ButtonColor = buttonColor, TextColor = textColor, BackgroundColor = backgroundColor}
- writeCFG = fs.open("musicsystem.cfg", "w")
- writeCFG.write( textutils.serialize( ColorTable ) )
- writeCFG.close()
- os.reboot()
- end
- function play(title)
- 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")
- play("C418 - 13")
- end
- function Cat()
- t:flash("Cat")
- play("C418 - cat")
- end
- function Blocks()
- t:flash("Blocks")
- play("C418 - blocks")
- end
- function Chirp()
- t:flash("Chirp")
- play("C418 - chirp")
- end
- function Far()
- t:flash("Far")
- play("C418 - far")
- end
- function Mall()
- t:flash("Mall")
- play("C418 - mall")
- end
- function Mellohi()
- t:flash("Mellohi")
- play("C418 - mellohi")
- end
- function Stal()
- t:flash("Stal")
- play("C418 - stal")
- end
- function Strad()
- t:flash("Strad")
- play("C418 - strad")
- end
- function Ward()
- t:flash("Ward")
- play("C418 - ward")
- end
- function Elev()
- t:flash("11")
- play("C418 - 11")
- end
- function Wait()
- t:flash("Wait")
- play("C418 - wait")
- end
- function Question()
- t:flash("???")
- play("corruption")
- end
- function GaiaOne()
- t:flash("Gaia 1")
- play("botania:gaia1")
- end
- function GaiaTwo()
- t:flash("Gaia 2")
- play("botania:gaia2")
- end
- function Roop()
- t:flash("R-Loop")
- play("portalgun:records.radioloop")
- end
- function Slive()
- t:flash("S-Alive")
- play("portalgun:records.stillalive")
- end
- function WYG()
- t:flash("WYG")
- play("portalgun:records.wantyougone")
- end
- function WDR()
- t:flash("Wanderer")
- play("wanderer")
- 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)
- os.reboot()
- end
- -- A list of all possible songs
- 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
- function update()
- settings:flash("Update")
- shell.run("rm startup")
- shell.run("rm touchpoint")
- shell.run("pastebin get Az75cPJ6 startup")
- shell.run("pastebin get pFHeia96 touchpoint")
- os.reboot()
- end
- --#Button Color Functions#--
- function whiteCol()
- buttonColor = 1
- colorSetText()
- end
- function orangeCol()
- buttonColor = 2
- colorSetText()
- end
- function magentaCol()
- buttonColor = 4
- colorSetText()
- end
- function lblueCol()
- buttonColor = 8
- colorSetText()
- end
- function yellowCol()
- buttonColor = 16
- colorSetText()
- end
- function limeCol()
- buttonColor = 32
- colorSetText()
- end
- function pinkCol()
- buttonColor = 64
- colorSetText()
- end
- function grayCol()
- buttonColor = 128
- colorSetText()
- end
- function lgrayCol()
- buttonColor = 256
- colorSetText()
- end
- function cyanCol()
- buttonColor = 512
- colorSetText()
- end
- function purpleCol()
- buttonColor = 1024
- colorSetText()
- end
- function blueCol()
- buttonColor = 2048
- colorSetText()
- end
- function brownCol()
- buttonColor = 4096
- colorSetText()
- end
- function greenCol()
- buttonColor = 8192
- colorSetText()
- end
- function redCol()
- buttonColor = 16384
- colorSetText()
- end
- function blackCol()
- buttonColor = 32768
- colorSetText()
- end
- --#Text Color Functions#--
- function twhiteCol()
- textColor = 1
- colorSetBackground()
- end
- function torangeCol()
- textColor = 2
- colorSetBackground()
- end
- function tmagentaCol()
- textColor = 4
- colorSetBackground()
- end
- function tlblueCol()
- textColor = 8
- colorSetBackground()
- end
- function tyellowCol()
- textColor = 16
- colorSetBackground()
- end
- function tlimeCol()
- textColor = 32
- colorSetBackground()
- end
- function tpinkCol()
- textColor = 64
- colorSetBackground()
- end
- function tgrayCol()
- textColor = 128
- colorSetBackground()
- end
- function tlgrayCol()
- textColor = 256
- colorSetBackground()
- end
- function tcyanCol()
- textColor = 512
- colorSetBackground()
- end
- function tpurpleCol()
- textColor = 1024
- colorSetBackground()
- end
- function tblueCol()
- textColor = 2048
- colorSetBackground()
- end
- function tbrownCol()
- textColor = 4096
- colorSetBackground()
- end
- function tgreenCol()
- textColor = 8192
- colorSetBackground()
- end
- function tredCol()
- textColor = 16384
- colorSetBackground()
- end
- function tblackCol()
- textColor = 32768
- colorSetBackground()
- end
- --#Background color functions#--
- function bwhiteCol()
- backgroundColor = 1
- colWrite()
- end
- function borangeCol()
- backgroundColor = 2
- colWrite()
- end
- function bmagentaCol()
- backgroundColor = 4
- colWrite()
- end
- function blblueCol()
- backgroundColor = 8
- colWrite()
- end
- function byellowCol()
- backgroundColor = 16
- colWrite()
- end
- function blimeCol()
- backgroundColor = 32
- colWrite()
- end
- function bpinkCol()
- backgroundColor = 64
- colWrite()
- end
- function bgrayCol()
- backgroundColor = 128
- colWrite()
- end
- function blgrayCol()
- backgroundColor = 256
- colWrite()
- end
- function bcyanCol()
- backgroundColor = 512
- colWrite()
- end
- function bpurpleCol()
- backgroundColor = 1024
- colWrite()
- end
- function bblueCol()
- backgroundColor = 2048
- colWrite()
- end
- function bbrownCol()
- backgroundColor = 4096
- colWrite()
- end
- function bgreenCol()
- backgroundColor = 8192
- colWrite()
- end
- function bredCol()
- backgroundColor = 16384
- colWrite()
- end
- function bblackCol()
- backgroundColor = 32768
- colWrite()
- end
- function resCol()
- t:flash("Reset")
- shell.run("rm musicsystem.cfg")
- os.reboot()
- end
- function main()
- tpage = home
- header = "HDR's Music System 2.5"
- tpoint()
- end
- function menu()
- tpage = settings
- header = "HDR's Music System 2.5"
- tpoint()
- end
- function colorSetButton()
- tpage = buttonColor
- header = "Select Button Color"
- tpoint()
- end
- function colorSetText()
- tpage = textColor
- header = "Select Text Color"
- tpoint()
- end
- function colorSetBackground()
- tpage = backgroundColor
- header = "Select Background Color"
- tpoint()
- end
- do
- --#Main Page Buttons#--
- home:add("13", Thir, 2,3,12,5, mainCol, textCol, textCol , mainCol)
- home:add("Cat", Cat, 14,3,24,5, mainCol, textCol, textCol , mainCol)
- home:add("Blocks", Blocks, 26,3,36,5, mainCol, textCol, textCol , mainCol)
- home:add("Chirp", Chirp, 38,3,48,5, mainCol, textCol, textCol , mainCol)
- home:add("Far", Far, 50,3,60,5, mainCol, textCol, textCol , mainCol)
- home:add("Mall", Mall, 2,7,12,9, mainCol, textCol, textCol , mainCol)
- home:add("Mellohi", Mellohi, 14,7,24,9, mainCol, textCol, textCol , mainCol)
- home:add("Stal", Stal, 26,7,36,9, mainCol, textCol, textCol , mainCol)
- home:add("Strad", Strad, 38,7,48,9, mainCol, textCol, textCol , mainCol)
- home:add("Ward", Ward, 50,7,60,9, mainCol, textCol, textCol , mainCol)
- home:add("11", Elev, 2,11,12,13, mainCol, textCol, textCol , mainCol)
- home:add("Wait", Wait, 14,11,24,13, mainCol, textCol, textCol , mainCol)
- home:add("???", Question, 26,11,36,13, mainCol, textCol, textCol , mainCol)
- home:add("Gaia 1", GaiaOne, 38,11,48,13, mainCol, textCol, textCol , mainCol)
- home:add("Gaia 2", GaiaTwo, 50,11,60,13, mainCol, textCol, textCol , mainCol)
- home:add("R-Loop", Roop, 8,15,18,17, mainCol, textCol, textCol , mainCol)
- home:add("S-Alive", Slive, 20,15,30,17, mainCol, textCol, textCol , mainCol)
- home:add("WYG", WYG, 32,15,42,17, mainCol, textCol, textCol , mainCol)
- home:add("Wanderer", WDR, 44,15,54,17, mainCol, textCol, textCol , mainCol)
- home:add("Random", Random, 14,19,24,19, mainCol, textCol, textCol , mainCol)
- home:add("Stop", Stop, 26,19,36,19, mainCol, textCol, textCol , mainCol)
- home:add("Settings", menu, 38,19,48,19, mainCol, textCol, textCol , mainCol)
- --#Settings Page Buttons#--
- settings:add("Update", update, 2,3,12,5, mainCol, textCol, textCol , mainCol)
- settings:add("Reboot", Reboot, 2,7,12,9, mainCol, textCol, textCol , mainCol)
- settings:add("Back", main, 1,19,11,19, mainCol, textCol, textCol , mainCol)
- settings:add("Customize", colorSetButton, 14,3,24,5, mainCol, textCol, textCol , mainCol)
- settings:add("Reset", resCol, 50,3,60,5, mainCol, textCol, textCol, mainCol)
- --#Button Color#--
- buttonColor:add("White", whiteCol, 2,3,12,5, colors.white, colors.black, colors.black, colors.white)
- buttonColor:add("Orange", orangeCol, 14,3,24,5, colors.orange, colors.black, colors.black, colors.orange)
- buttonColor:add("Magenta", magentaCol, 26,3,36,5, colors.magenta, colors.black, colors.black, colors.magenta)
- buttonColor:add("L-Blue", lblueCol, 38,3,48,5, colors.lightBlue, colors.black, colors.black, colors.lightBlue)
- buttonColor:add("Yellow", yellowCol, 50,3,60,5, colors.yellow, colors.black, colors.black, colors.yellow)
- buttonColor:add("Lime", limeCol, 2,7,12,9, colors.lime, colors.black, colors.black, colors.lime)
- buttonColor:add("Pink", pinkCol, 14,7,24,9, colors.pink, colors.black, colors.black, colors.pink)
- buttonColor:add("Gray", grayCol, 26,7,36,9, colors.gray, colors.black, colors.black, colors.gray)
- buttonColor:add("L-Gray", lgrayCol, 38,7,48,9, colors.lightGray, colors.black, colors.black, colors.lightGray)
- buttonColor:add("Cyan", cyanCol, 50,7,60,9, colors.cyan, colors.black, colors.black, colors.cyan)
- buttonColor:add("Purple", purpleCol, 2,11,12,13, colors.purple, colors.black, colors.black, colors.purple)
- buttonColor:add("Blue", blueCol, 14,11,24,13, colors.blue, colors.black, colors.black, colors.blue)
- buttonColor:add("Brown", brownCol, 26,11,36,13, colors.brown, colors.black, colors.black, colors.brown)
- buttonColor:add("Green", greenCol, 38,11,48,13, colors.green, colors.black, colors.black, colors.green)
- buttonColor:add("Red", redCol, 50,11,60,13, colors.red, colors.black, colors.black, colors.red)
- buttonColor:add("Black", blackCol, 26,15,36,17, colors.black, colors.black, colors.white, colors.white)
- buttonColor:add("Back", menu, 1,19,11,19, mainCol, colors.lime, colors.orange, colors.orange)
- --#Text Color#--
- textColor:add("White", twhiteCol, 2,3,12,5, colors.white, colors.black, colors.black, colors.white)
- textColor:add("Orange", torangeCol, 14,3,24,5, colors.orange, colors.black, colors.black, colors.orange)
- textColor:add("Magenta", tmagentaCol, 26,3,36,5, colors.magenta, colors.black, colors.black, colors.magenta)
- textColor:add("L-Blue", tlblueCol, 38,3,48,5, colors.lightBlue, colors.black, colors.black, colors.lightBlue)
- textColor:add("Yellow", tyellowCol, 50,3,60,5, colors.yellow, colors.black, colors.black, colors.yellow)
- textColor:add("Lime", tlimeCol, 2,7,12,9, colors.lime, colors.black, colors.black, colors.lime)
- textColor:add("Pink", tpinkCol, 14,7,24,9, colors.pink, colors.black, colors.black, colors.pink)
- textColor:add("Gray", tgrayCol, 26,7,36,9, colors.gray, colors.black, colors.black, colors.gray)
- textColor:add("L-Gray", tlgrayCol, 38,7,48,9, colors.lightGray, colors.black, colors.black, colors.lightGray)
- textColor:add("Cyan", tcyanCol, 50,7,60,9, colors.cyan, colors.black, colors.black, colors.cyan)
- textColor:add("Purple", tpurpleCol, 2,11,12,13, colors.purple, colors.black, colors.black, colors.purple)
- textColor:add("Blue", tblueCol, 14,11,24,13, colors.blue, colors.black, colors.black, colors.blue)
- textColor:add("Brown", tbrownCol, 26,11,36,13, colors.brown, colors.black, colors.black, colors.brown)
- textColor:add("Green", tgreenCol, 38,11,48,13, colors.green, colors.black, colors.black, colors.green)
- textColor:add("Red", tredCol, 50,11,60,13, colors.red, colors.black, colors.black, colors.red)
- textColor:add("Black", tblackCol, 26,15,36,17, colors.black, colors.black, colors.white, colors.white)
- --#Background Color#--
- backgroundColor:add("White", bwhiteCol, 2,3,12,5, colors.white, colors.black, colors.black, colors.white)
- backgroundColor:add("Orange", borangeCol, 14,3,24,5, colors.orange, colors.black, colors.black, colors.orange)
- backgroundColor:add("Magenta", bmagentaCol, 26,3,36,5, colors.magenta, colors.black, colors.black, colors.magenta)
- backgroundColor:add("L-Blue", blblueCol, 38,3,48,5, colors.lightBlue, colors.black, colors.black, colors.lightBlue)
- backgroundColor:add("Yellow", byellowCol, 50,3,60,5, colors.yellow, colors.black, colors.black, colors.yellow)
- backgroundColor:add("Lime", blimeCol, 2,7,12,9, colors.lime, colors.black, colors.black, colors.lime)
- backgroundColor:add("Pink", bpinkCol, 14,7,24,9, colors.pink, colors.black, colors.black, colors.pink)
- backgroundColor:add("Gray", bgrayCol, 26,7,36,9, colors.gray, colors.black, colors.black, colors.gray)
- backgroundColor:add("L-Gray", blgrayCol, 38,7,48,9, colors.lightGray, colors.black, colors.black, colors.lightGray)
- backgroundColor:add("Cyan", bcyanCol, 50,7,60,9, colors.cyan, colors.black, colors.black, colors.cyan)
- backgroundColor:add("Purple", bpurpleCol, 2,11,12,13, colors.purple, colors.black, colors.black, colors.purple)
- backgroundColor:add("Blue", bblueCol, 14,11,24,13, colors.blue, colors.black, colors.black, colors.blue)
- backgroundColor:add("Brown", bbrownCol, 26,11,36,13, colors.brown, colors.black, colors.black, colors.brown)
- backgroundColor:add("Green", bgreenCol, 38,11,48,13, colors.green, colors.black, colors.black, colors.green)
- backgroundColor:add("Red", bredCol, 50,11,60,13, colors.red, colors.black, colors.black, colors.red)
- backgroundColor:add("Black", bblackCol, 26,15,36,17, colors.black, colors.black, colors.white, colors.white)
- end
- main()
- while true do
- t:draw()
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t.buttonList[p1].func()
- end
- end
Add Comment
Please, Sign In to add comment