Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Made By HDR - @MartinRefseth #--
- --# Version 2.4#--
- --# 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
- page1 = touchpoint.new(b)
- page2 = touchpoint.new(b)
- mainColr = touchpoint.new(b)
- textColr = touchpoint.new(b)
- backColr = touchpoint.new(b)
- local t
- break
- end
- end
- if fs.exists("mainColor") == true then
- -- Do Nothing --
- else
- setMain = fs.open("mainColor", "w")
- setMain.write("512")
- setMain.close()
- end
- mainColRead = io.open( "mainColor", "r" )
- mainColSet = mainColRead:read("*a")
- mainColRead:close()
- mainCol = tonumber(mainColSet)
- if fs.exists("textColor") == true then
- -- Do Nothing --
- else
- setText = fs.open("textColor", "w")
- setText.write("2")
- setText.close()
- end
- textColRead = io.open( "textColor", "r" )
- textColSet = textColRead:read("*a")
- textColRead:close()
- textCol = tonumber(textColSet)
- if fs.exists("backColor") == true then
- -- Do Nothing --
- else
- setBack = fs.open("backColor", "w")
- setBack.write("128")
- setBack.close()
- end
- backColRead = io.open( "backColor", "r" )
- backColSet = backColRead:read("*a")
- backColRead:close()
- backCol = tonumber(backColSet)
- --# 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()
- setMain = fs.open("mainColor", "w")
- setMain.write(colNum)
- setMain.close()
- os.reboot()
- end
- function tcolWrite()
- setText = fs.open("textColor", "w")
- setText.write(colNum)
- setText.close()
- os.reboot()
- end
- function bcolWrite()
- setBack = fs.open("backColor", "w")
- setBack.write(colNum)
- setBack.close()
- os.reboot()
- end
- 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
- function Question()
- t:flash("???")
- title = "corruption"
- play()
- end
- function GaiaOne()
- t:flash("Gaia 1")
- title = "botania:gaia1"
- play()
- end
- function GaiaTwo()
- t:flash("Gaia 2")
- title = "botania:gaia2"
- play()
- end
- function Roop()
- t:flash("R-Loop")
- title = "portalgun:records.radioloop"
- play()
- end
- function Slive()
- t:flash("S-Alive")
- title = "portalgun:records.stillalive"
- play()
- end
- function WYG()
- t:flash("WYG")
- title = "portalgun:records.wantyougone"
- play()
- end
- function WDR()
- t:flash("Wanderer")
- title = "wanderer"
- 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)
- 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()
- page2: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()
- colNum = 1
- colWrite()
- end
- function orangeCol()
- colNum = 2
- colWrite()
- end
- function magentaCol()
- colNum = 4
- colWrite()
- end
- function lblueCol()
- colNum = 8
- colWrite()
- end
- function yellowCol()
- colNum = 16
- colWrite()
- end
- function limeCol()
- colNum = 32
- colWrite()
- end
- function pinkCol()
- colNum = 64
- colWrite()
- end
- function grayCol()
- colNum = 128
- colWrite()
- end
- function lgrayCol()
- colNum = 256
- colWrite()
- end
- function cyanCol()
- colNum = 512
- colWrite()
- end
- function purpleCol()
- colNum = 1024
- colWrite()
- end
- function blueCol()
- colNum = 2048
- colWrite()
- end
- function brownCol()
- colNum = 4096
- colWrite()
- end
- function greenCol()
- colNum = 8192
- colWrite()
- end
- function redCol()
- colNum = 16384
- colWrite()
- end
- function blackCol()
- colNum = 32768
- colWrite()
- end
- --#Text Color Functions#--
- function twhiteCol()
- colNum = 1
- tcolWrite()
- end
- function torangeCol()
- colNum = 2
- tcolWrite()
- end
- function tmagentaCol()
- colNum = 4
- tcolWrite()
- end
- function tlblueCol()
- colNum = 8
- tcolWrite()
- end
- function tyellowCol()
- colNum = 16
- tcolWrite()
- end
- function tlimeCol()
- colNum = 32
- tcolWrite()
- end
- function tpinkCol()
- colNum = 64
- tcolWrite()
- end
- function tgrayCol()
- colNum = 128
- tcolWrite()
- end
- function tlgrayCol()
- colNum = 256
- tcolWrite()
- end
- function tcyanCol()
- colNum = 512
- tcolWrite()
- end
- function tpurpleCol()
- colNum = 1024
- tcolWrite()
- end
- function tblueCol()
- colNum = 2048
- tcolWrite()
- end
- function tbrownCol()
- colNum = 4096
- tcolWrite()
- end
- function tgreenCol()
- colNum = 8192
- tcolWrite()
- end
- function tredCol()
- colNum = 16384
- tcolWrite()
- end
- --#Background color functions#--
- function tblackCol()
- colNum = 32768
- tcolWrite()
- end
- function bwhiteCol()
- colNum = 1
- bcolWrite()
- end
- function borangeCol()
- colNum = 2
- bcolWrite()
- end
- function bmagentaCol()
- colNum = 4
- bcolWrite()
- end
- function blblueCol()
- colNum = 8
- bcolWrite()
- end
- function byellowCol()
- colNum = 16
- bcolWrite()
- end
- function blimeCol()
- colNum = 32
- bcolWrite()
- end
- function bpinkCol()
- colNum = 64
- bcolWrite()
- end
- function bgrayCol()
- colNum = 128
- bcolWrite()
- end
- function blgrayCol()
- colNum = 256
- bcolWrite()
- end
- function bcyanCol()
- colNum = 512
- bcolWrite()
- end
- function bpurpleCol()
- colNum = 1024
- bcolWrite()
- end
- function bblueCol()
- colNum = 2048
- bcolWrite()
- end
- function bbrownCol()
- colNum = 4096
- bcolWrite()
- end
- function bgreenCol()
- colNum = 8192
- bcolWrite()
- end
- function bredCol()
- colNum = 16384
- bcolWrite()
- end
- function bblackCol()
- colNum = 32768
- bcolWrite()
- end
- function resCol()
- t:flash("Reset")
- shell.run("rm mainColor")
- shell.run("rm textColor")
- shell.run("rm backColor")
- os.reboot()
- end
- function main()
- tpage = page1
- header = "HDR's Music System 2.4"
- tpoint()
- end
- function pg2()
- tpage = page2
- header = "HDR's Music System 2.4"
- tpoint()
- end
- function colorSet()
- tpage = mainColr
- header = "Set Button Color"
- tpoint()
- end
- function textSet()
- tpage = textColr
- header = "Set Text Color"
- tpoint()
- end
- function backSet()
- tpage = backColr
- header = "Set Background Color"
- tpoint()
- end
- do
- --#Main Page Buttons#--
- page1:add("13", Thir, 2,3,12,5, mainCol, textCol, textCol , mainCol)
- page1:add("Cat", Cat, 14,3,24,5, mainCol, textCol, textCol , mainCol)
- page1:add("Blocks", Blocks, 26,3,36,5, mainCol, textCol, textCol , mainCol)
- page1:add("Chirp", Chirp, 38,3,48,5, mainCol, textCol, textCol , mainCol)
- page1:add("Far", Far, 50,3,60,5, mainCol, textCol, textCol , mainCol)
- page1:add("Mall", Mall, 2,7,12,9, mainCol, textCol, textCol , mainCol)
- page1:add("Mellohi", Mellohi, 14,7,24,9, mainCol, textCol, textCol , mainCol)
- page1:add("Stal", Stal, 26,7,36,9, mainCol, textCol, textCol , mainCol)
- page1:add("Strad", Strad, 38,7,48,9, mainCol, textCol, textCol , mainCol)
- page1:add("Ward", Ward, 50,7,60,9, mainCol, textCol, textCol , mainCol)
- page1:add("11", Elev, 2,11,12,13, mainCol, textCol, textCol , mainCol)
- page1:add("Wait", Wait, 14,11,24,13, mainCol, textCol, textCol , mainCol)
- page1:add("???", Question, 26,11,36,13, mainCol, textCol, textCol , mainCol)
- page1:add("Gaia 1", GaiaOne, 38,11,48,13, mainCol, textCol, textCol , mainCol)
- page1:add("Gaia 2", GaiaTwo, 50,11,60,13, mainCol, textCol, textCol , mainCol)
- page1:add("R-Loop", Roop, 8,15,18,17, mainCol, textCol, textCol , mainCol)
- page1:add("S-Alive", Slive, 20,15,30,17, mainCol, textCol, textCol , mainCol)
- page1:add("WYG", WYG, 32,15,42,17, mainCol, textCol, textCol , mainCol)
- page1:add("Wanderer", WDR, 44,15,54,17, mainCol, textCol, textCol , mainCol)
- page1:add("Random", Random, 14,19,24,19, mainCol, textCol, textCol , mainCol)
- page1:add("Stop", Stop, 26,19,36,19, mainCol, textCol, textCol , mainCol)
- page1:add("Settings", pg2, 38,19,48,19, mainCol, textCol, textCol , mainCol)
- --#Settings Page Buttons#--
- page2:add("Update", update, 2,3,12,5, mainCol, textCol, textCol , mainCol)
- page2:add("Reboot", Reboot, 2,7,12,9, mainCol, textCol, textCol , mainCol)
- page2:add("Back", main, 1,19,11,19, mainCol, textCol, textCol , mainCol)
- page2:add("ButtonCol", colorSet, 14,3,24,5, mainCol, textCol, textCol , mainCol)
- page2:add("TextCol", textSet, 26,3,36,5, mainCol, textCol, textCol , mainCol)
- page2:add("BackgrCol", backSet, 38,3,48,5, mainCol, textCol, textCol, mainCol)
- page2:add("Reset", resCol, 50,3,60,5, mainCol, textCol, textCol, mainCol)
- --#Button Color#--
- mainColr:add("White", whiteCol, 2,3,12,5, colors.white, colors.black, colors.black, colors.white)
- mainColr:add("Orange", orangeCol, 14,3,24,5, colors.orange, colors.black, colors.black, colors.orange)
- mainColr:add("Magenta", magentaCol, 26,3,36,5, colors.magenta, colors.black, colors.black, colors.magenta)
- mainColr:add("L-Blue", lblueCol, 38,3,48,5, colors.lightBlue, colors.black, colors.black, colors.lightBlue)
- mainColr:add("Yellow", yellowCol, 50,3,60,5, colors.yellow, colors.black, colors.black, colors.yellow)
- mainColr:add("Lime", limeCol, 2,7,12,9, colors.lime, colors.black, colors.black, colors.lime)
- mainColr:add("Pink", pinkCol, 14,7,24,9, colors.pink, colors.black, colors.black, colors.pink)
- mainColr:add("Gray", grayCol, 26,7,36,9, colors.gray, colors.black, colors.black, colors.gray)
- mainColr:add("L-Gray", lgrayCol, 38,7,48,9, colors.lightGray, colors.black, colors.black, colors.lightGray)
- mainColr:add("Cyan", cyanCol, 50,7,60,9, colors.cyan, colors.black, colors.black, colors.cyan)
- mainColr:add("Purple", purpleCol, 2,11,12,13, colors.purple, colors.black, colors.black, colors.purple)
- mainColr:add("Blue", blueCol, 14,11,24,13, colors.blue, colors.black, colors.black, colors.blue)
- mainColr:add("Brown", brownCol, 26,11,36,13, colors.brown, colors.black, colors.black, colors.brown)
- mainColr:add("Green", greenCol, 38,11,48,13, colors.green, colors.black, colors.black, colors.green)
- mainColr:add("Red", redCol, 50,11,60,13, colors.red, colors.black, colors.black, colors.red)
- mainColr:add("Black", blackCol, 26,15,36,17, colors.black, colors.black, colors.white, colors.white)
- mainColr:add("Back", main, 1,19,11,19, mainCol, colors.lime, colors.orange, colors.orange)
- --#Text Color#--
- textColr:add("White", twhiteCol, 2,3,12,5, colors.white, colors.black, colors.black, colors.white)
- textColr:add("Orange", torangeCol, 14,3,24,5, colors.orange, colors.black, colors.black, colors.orange)
- textColr:add("Magenta", tmagentaCol, 26,3,36,5, colors.magenta, colors.black, colors.black, colors.magenta)
- textColr:add("L-Blue", tlblueCol, 38,3,48,5, colors.lightBlue, colors.black, colors.black, colors.lightBlue)
- textColr:add("Yellow", tyellowCol, 50,3,60,5, colors.yellow, colors.black, colors.black, colors.yellow)
- textColr:add("Lime", tlimeCol, 2,7,12,9, colors.lime, colors.black, colors.black, colors.lime)
- textColr:add("Pink", tpinkCol, 14,7,24,9, colors.pink, colors.black, colors.black, colors.pink)
- textColr:add("Gray", tgrayCol, 26,7,36,9, colors.gray, colors.black, colors.black, colors.gray)
- textColr:add("L-Gray", tlgrayCol, 38,7,48,9, colors.lightGray, colors.black, colors.black, colors.lightGray)
- textColr:add("Cyan", tcyanCol, 50,7,60,9, colors.cyan, colors.black, colors.black, colors.cyan)
- textColr:add("Purple", tpurpleCol, 2,11,12,13, colors.purple, colors.black, colors.black, colors.purple)
- textColr:add("Blue", tblueCol, 14,11,24,13, colors.blue, colors.black, colors.black, colors.blue)
- textColr:add("Brown", tbrownCol, 26,11,36,13, colors.brown, colors.black, colors.black, colors.brown)
- textColr:add("Green", tgreenCol, 38,11,48,13, colors.green, colors.black, colors.black, colors.green)
- textColr:add("Red", tredCol, 50,11,60,13, colors.red, colors.black, colors.black, colors.red)
- textColr:add("Black", tblackCol, 26,15,36,17, colors.black, colors.black, colors.white, colors.white)
- textColr:add("Back", main, 1,19,11,19, mainCol, textCol, textCol , mainCol)
- --#Background Color#--
- backColr:add("White", bwhiteCol, 2,3,12,5, colors.white, colors.black, colors.black, colors.white)
- backColr:add("Orange", borangeCol, 14,3,24,5, colors.orange, colors.black, colors.black, colors.orange)
- backColr:add("Magenta", bmagentaCol, 26,3,36,5, colors.magenta, colors.black, colors.black, colors.magenta)
- backColr:add("L-Blue", blblueCol, 38,3,48,5, colors.lightBlue, colors.black, colors.black, colors.lightBlue)
- backColr:add("Yellow", byellowCol, 50,3,60,5, colors.yellow, colors.black, colors.black, colors.yellow)
- backColr:add("Lime", blimeCol, 2,7,12,9, colors.lime, colors.black, colors.black, colors.lime)
- backColr:add("Pink", bpinkCol, 14,7,24,9, colors.pink, colors.black, colors.black, colors.pink)
- backColr:add("Gray", bgrayCol, 26,7,36,9, colors.gray, colors.black, colors.black, colors.gray)
- backColr:add("L-Gray", blgrayCol, 38,7,48,9, colors.lightGray, colors.black, colors.black, colors.lightGray)
- backColr:add("Cyan", bcyanCol, 50,7,60,9, colors.cyan, colors.black, colors.black, colors.cyan)
- backColr:add("Purple", bpurpleCol, 2,11,12,13, colors.purple, colors.black, colors.black, colors.purple)
- backColr:add("Blue", bblueCol, 14,11,24,13, colors.blue, colors.black, colors.black, colors.blue)
- backColr:add("Brown", bbrownCol, 26,11,36,13, colors.brown, colors.black, colors.black, colors.brown)
- backColr:add("Green", bgreenCol, 38,11,48,13, colors.green, colors.black, colors.black, colors.green)
- backColr:add("Red", bredCol, 50,11,60,13, colors.red, colors.black, colors.black, colors.red)
- backColr:add("Black", bblackCol, 26,15,36,17, colors.black, colors.black, colors.white, colors.white)
- backColr:add("Back", main, 1,19,11,19, mainCol, textCol, textCol , mainCol)
- 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